Skip to content

Commit

Permalink
lint: Fix lint from new Rust version
Browse files Browse the repository at this point in the history
After the upgrade to the new Rust version, a lot of warnings of the
form "warning: elided lifetime has a name" were appearing. This commit
resolves those warnings by adding explicit lifetime names.
  • Loading branch information
jkosh44 committed Jan 2, 2025
1 parent ace7379 commit 9014e97
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/adapter/src/coord/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Coordinator {
pub(crate) async fn ensure_timeline_state<'a>(
&'a mut self,
timeline: &'a Timeline,
) -> &mut TimelineState<Timestamp> {
) -> &'a mut TimelineState<Timestamp> {
Self::ensure_timeline_state_with_initial_time(
timeline,
Timestamp::minimum(),
Expand Down
2 changes: 1 addition & 1 deletion src/catalog/src/durable/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<'a> Transaction<'a> {
txn_wal_shard,
}: Snapshot,
upper: mz_repr::Timestamp,
) -> Result<Transaction, CatalogError> {
) -> Result<Transaction<'a>, CatalogError> {
Ok(Transaction {
durable_catalog,
databases: TableTransaction::new_with_uniqueness_fn(
Expand Down
2 changes: 1 addition & 1 deletion src/expr/src/explain/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ impl MirRelationExpr {
fn column_names<'a>(
&'a self,
ctx: &'a PlanRenderingContext<'_, MirRelationExpr>,
) -> Option<&Vec<String>> {
) -> Option<&'a Vec<String>> {
if !ctx.config.humanized_exprs {
None
} else if let Some(analyses) = ctx.annotations.get(self) {
Expand Down
2 changes: 1 addition & 1 deletion src/pgwire-common/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub struct Cursor<'a> {
impl<'a> Cursor<'a> {
/// Constructs a new `Cursor` from a byte slice. The cursor will begin
/// decoding from the beginning of the slice.
pub fn new(buf: &'a [u8]) -> Cursor {
pub fn new(buf: &'a [u8]) -> Cursor<'a> {
Cursor { buf }
}

Expand Down
2 changes: 1 addition & 1 deletion src/repr/src/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pub struct RenderingContext<'a> {
}

impl<'a> RenderingContext<'a> {
pub fn new(indent: Indent, humanizer: &'a dyn ExprHumanizer) -> RenderingContext {
pub fn new(indent: Indent, humanizer: &'a dyn ExprHumanizer) -> RenderingContext<'a> {
RenderingContext { indent, humanizer }
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/sql-pretty/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ where

pub(crate) fn title_comma_separate<'a, F, T, S>(title: S, f: F, v: &'a [T]) -> RcDoc<'a, ()>
where
F: Fn(&'a T) -> RcDoc,
F: Fn(&'a T) -> RcDoc<'a>,
S: Into<String>,
{
let title = RcDoc::text(title.into());
Expand All @@ -50,15 +50,15 @@ pub(crate) fn nest_comma_separate<'a, F, T: 'a, I>(
v: I,
) -> RcDoc<'a, ()>
where
F: Fn(&'a T) -> RcDoc,
F: Fn(&'a T) -> RcDoc<'a>,
I: IntoIterator<Item = &'a T>,
{
nest(title, comma_separate(f, v))
}

pub(crate) fn comma_separate<'a, F, T: 'a, I>(f: F, v: I) -> RcDoc<'a, ()>
where
F: Fn(&'a T) -> RcDoc,
F: Fn(&'a T) -> RcDoc<'a>,
I: IntoIterator<Item = &'a T>,
{
let docs = v.into_iter().map(f);
Expand Down
4 changes: 2 additions & 2 deletions src/sql/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ pub trait SessionCatalog: fmt::Debug + ExprHumanizer + Send + Sync + ConnectionR
fn resolve_cluster<'a, 'b>(
&'a self,
cluster_name: Option<&'b str>,
) -> Result<&dyn CatalogCluster<'a>, CatalogError>;
) -> Result<&'a dyn CatalogCluster<'a>, CatalogError>;

/// Resolves the named cluster replica.
fn resolve_cluster_replica<'a, 'b>(
&'a self,
cluster_replica_name: &'b QualifiedReplica,
) -> Result<&dyn CatalogClusterReplica<'a>, CatalogError>;
) -> Result<&'a dyn CatalogClusterReplica<'a>, CatalogError>;

/// Resolves a partially-specified item name, that is NOT a function or
/// type. (For resolving functions or types, please use
Expand Down
2 changes: 1 addition & 1 deletion src/sql/src/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ pub struct NameResolver<'a> {
}

impl<'a> NameResolver<'a> {
fn new(catalog: &'a dyn SessionCatalog) -> NameResolver {
fn new(catalog: &'a dyn SessionCatalog) -> NameResolver<'a> {
NameResolver {
catalog,
ctes: BTreeMap::new(),
Expand Down
2 changes: 1 addition & 1 deletion src/sql/src/pure/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl RetrievedSourceReferences {
&'a self,
requested: Option<&ExternalReferences>,
source_name: &UnresolvedItemName,
) -> Result<Vec<RequestedSourceExport<&ReferenceMetadata>>, PlanError> {
) -> Result<Vec<RequestedSourceExport<&'a ReferenceMetadata>>, PlanError> {
// Filter all available references to those requested by the `ExternalReferences`
// specification and include any alias that the user has specified.
// TODO(database-issues#8620): The alias handling can be removed once subsources are removed.
Expand Down
2 changes: 1 addition & 1 deletion src/storage-types/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl RelationPartStats<'_> {
num_oks.map(|num_oks| num_results - num_oks)
}

fn col_values<'a>(&'a self, idx: usize, arena: &'a RowArena) -> Option<ResultSpec> {
fn col_values<'a>(&'a self, idx: usize, arena: &'a RowArena) -> Option<ResultSpec<'a>> {
let name = self.desc.get_name(idx);
let typ = &self.desc.typ().column_types[idx];

Expand Down
2 changes: 1 addition & 1 deletion src/walkabout/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum Item {
}

impl Item {
pub fn fields<'a>(&'a self) -> Box<dyn Iterator<Item = &Field> + 'a> {
pub fn fields<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Field> + 'a> {
match self {
Item::Struct(s) => Box::new(s.fields.iter()),
Item::Enum(e) => Box::new(e.variants.iter().flat_map(|v| &v.fields)),
Expand Down

0 comments on commit 9014e97

Please sign in to comment.