From 5dc5c2e042f7c9acda38173995b7f920aa5fc5e9 Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Thu, 3 Oct 2024 23:05:48 -0700 Subject: [PATCH] chore: fix lifetime lints --- assembly/src/assembler/basic_block_builder.rs | 8 ++++---- assembly/src/assembler/module_graph/debug.rs | 8 ++++---- assembly/src/assembler/module_graph/mod.rs | 2 +- assembly/src/ast/attribute/set.rs | 4 ++-- assembly/src/ast/visit.rs | 4 ++-- assembly/src/compile.rs | 12 ++++++------ assembly/src/library/path.rs | 10 +++++----- assembly/src/parser/mod.rs | 2 +- assembly/src/parser/token.rs | 2 +- assembly/src/sema/passes/const_eval.rs | 4 ++-- assembly/src/sema/passes/verify_invoke.rs | 4 ++-- core/src/mast/node/basic_block_node/mod.rs | 4 ++-- core/src/mast/node/call_node.rs | 6 +++--- core/src/mast/node/dyn_node.rs | 6 +++--- core/src/mast/node/external.rs | 6 +++--- core/src/mast/node/join_node.rs | 4 ++-- core/src/mast/node/loop_node.rs | 4 ++-- core/src/mast/node/mod.rs | 4 ++-- core/src/mast/node/split_node.rs | 4 ++-- core/src/mast/serialization/basic_blocks.rs | 2 +- processor/src/host/advice/mod.rs | 2 +- processor/src/host/mod.rs | 2 +- prover/src/gpu/metal/mod.rs | 2 +- 23 files changed, 53 insertions(+), 53 deletions(-) diff --git a/assembly/src/assembler/basic_block_builder.rs b/assembly/src/assembler/basic_block_builder.rs index 1113e1fea..3246484d2 100644 --- a/assembly/src/assembler/basic_block_builder.rs +++ b/assembly/src/assembler/basic_block_builder.rs @@ -60,7 +60,7 @@ impl<'a> BasicBlockBuilder<'a> { } /// Accessors -impl<'a> BasicBlockBuilder<'a> { +impl BasicBlockBuilder<'_> { /// Returns a reference to the internal [`MastForestBuilder`]. pub fn mast_forest_builder(&self) -> &MastForestBuilder { self.mast_forest_builder @@ -73,7 +73,7 @@ impl<'a> BasicBlockBuilder<'a> { } /// Operations -impl<'a> BasicBlockBuilder<'a> { +impl BasicBlockBuilder<'_> { /// Adds the specified operation to the list of basic block operations. pub fn push_op(&mut self, op: Operation) { self.ops.push(op); @@ -96,7 +96,7 @@ impl<'a> BasicBlockBuilder<'a> { } /// Decorators -impl<'a> BasicBlockBuilder<'a> { +impl BasicBlockBuilder<'_> { /// Add the specified decorator to the list of basic block decorators. pub fn push_decorator(&mut self, decorator: Decorator) -> Result<(), AssemblyError> { let decorator_id = self.mast_forest_builder.ensure_decorator(decorator)?; @@ -159,7 +159,7 @@ impl<'a> BasicBlockBuilder<'a> { } /// Span Constructors -impl<'a> BasicBlockBuilder<'a> { +impl BasicBlockBuilder<'_> { /// Creates and returns a new basic block node from the operations and decorators currently in /// this builder. /// diff --git a/assembly/src/assembler/module_graph/debug.rs b/assembly/src/assembler/module_graph/debug.rs index bf584fad1..eea58adf4 100644 --- a/assembly/src/assembler/module_graph/debug.rs +++ b/assembly/src/assembler/module_graph/debug.rs @@ -14,7 +14,7 @@ impl fmt::Debug for ModuleGraph { #[doc(hidden)] struct DisplayModuleGraph<'a>(&'a ModuleGraph); -impl<'a> fmt::Debug for DisplayModuleGraph<'a> { +impl fmt::Debug for DisplayModuleGraph<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_set() .entries(self.0.modules.iter().enumerate().flat_map(|(module_index, m)| { @@ -56,7 +56,7 @@ impl<'a> fmt::Debug for DisplayModuleGraph<'a> { #[doc(hidden)] struct DisplayModuleGraphNodes<'a>(&'a Vec); -impl<'a> fmt::Debug for DisplayModuleGraphNodes<'a> { +impl fmt::Debug for DisplayModuleGraphNodes<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list() .entries(self.0.iter().enumerate().flat_map(|(module_index, m)| { @@ -111,7 +111,7 @@ struct DisplayModuleGraphNode<'a> { ty: GraphNodeType, } -impl<'a> fmt::Debug for DisplayModuleGraphNode<'a> { +impl fmt::Debug for DisplayModuleGraphNode<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Node") .field("id", &format_args!("{}:{}", &self.module.as_usize(), &self.index.as_usize())) @@ -128,7 +128,7 @@ struct DisplayModuleGraphNodeWithEdges<'a> { out_edges: &'a [GlobalProcedureIndex], } -impl<'a> fmt::Debug for DisplayModuleGraphNodeWithEdges<'a> { +impl fmt::Debug for DisplayModuleGraphNodeWithEdges<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Edge") .field( diff --git a/assembly/src/assembler/module_graph/mod.rs b/assembly/src/assembler/module_graph/mod.rs index c96617a31..f8116f998 100644 --- a/assembly/src/assembler/module_graph/mod.rs +++ b/assembly/src/assembler/module_graph/mod.rs @@ -39,7 +39,7 @@ pub enum ProcedureWrapper<'a> { Info(&'a ProcedureInfo), } -impl<'a> ProcedureWrapper<'a> { +impl ProcedureWrapper<'_> { /// Returns the name of the procedure. pub fn name(&self) -> &ProcedureName { match self { diff --git a/assembly/src/ast/attribute/set.rs b/assembly/src/ast/attribute/set.rs index bbf69698a..f215f96db 100644 --- a/assembly/src/ast/attribute/set.rs +++ b/assembly/src/ast/attribute/set.rs @@ -197,7 +197,7 @@ pub struct AttributeSetOccupiedEntry<'a> { set: &'a mut AttributeSet, index: usize, } -impl<'a> AttributeSetOccupiedEntry<'a> { +impl AttributeSetOccupiedEntry<'_> { #[inline] pub fn get(&self) -> &Attribute { &self.set.attrs[self.index] @@ -228,7 +228,7 @@ pub struct AttributeSetVacantEntry<'a> { key: Ident, index: usize, } -impl<'a> AttributeSetVacantEntry<'a> { +impl AttributeSetVacantEntry<'_> { pub fn insert(self, attr: Attribute) { if self.key != attr.id() { self.set.insert(attr); diff --git a/assembly/src/ast/visit.rs b/assembly/src/ast/visit.rs index b9d60cbe6..ecd11fb86 100644 --- a/assembly/src/ast/visit.rs +++ b/assembly/src/ast/visit.rs @@ -139,7 +139,7 @@ pub trait Visit { } } -impl<'a, V, T> Visit for &'a mut V +impl Visit for &mut V where V: ?Sized + Visit, { @@ -575,7 +575,7 @@ pub trait VisitMut { } } -impl<'a, V, T> VisitMut for &'a mut V +impl VisitMut for &mut V where V: ?Sized + VisitMut, { diff --git a/assembly/src/compile.rs b/assembly/src/compile.rs index 1d2fda3a4..2e36858cd 100644 --- a/assembly/src/compile.rs +++ b/assembly/src/compile.rs @@ -130,7 +130,7 @@ impl Compile for Module { } } -impl<'a> Compile for &'a Module { +impl Compile for &Module { #[inline(always)] fn compile_with_options( self, @@ -197,7 +197,7 @@ impl Compile for Arc { } } -impl<'a> Compile for &'a str { +impl Compile for &str { #[inline(always)] fn compile_with_options( self, @@ -208,7 +208,7 @@ impl<'a> Compile for &'a str { } } -impl<'a> Compile for &'a String { +impl Compile for &String { #[inline(always)] fn compile_with_options( self, @@ -251,7 +251,7 @@ impl Compile for Box { } } -impl<'a> Compile for Cow<'a, str> { +impl Compile for Cow<'_, str> { #[inline(always)] fn compile_with_options( self, @@ -265,7 +265,7 @@ impl<'a> Compile for Cow<'a, str> { // COMPILE IMPLEMENTATIONS FOR BYTES // ------------------------------------------------------------------------------------------------ -impl<'a> Compile for &'a [u8] { +impl Compile for &[u8] { #[inline] fn compile_with_options( self, @@ -350,7 +350,7 @@ where // ------------------------------------------------------------------------------------------------ #[cfg(feature = "std")] -impl<'a> Compile for &'a std::path::Path { +impl Compile for &std::path::Path { fn compile_with_options( self, source_manager: &dyn SourceManager, diff --git a/assembly/src/library/path.rs b/assembly/src/library/path.rs index a77ea1b28..22e5fe847 100644 --- a/assembly/src/library/path.rs +++ b/assembly/src/library/path.rs @@ -65,9 +65,9 @@ impl<'a> LibraryPathComponent<'a> { } } -impl<'a> Eq for LibraryPathComponent<'a> {} +impl Eq for LibraryPathComponent<'_> {} -impl<'a> PartialEq for LibraryPathComponent<'a> { +impl PartialEq for LibraryPathComponent<'_> { fn eq(&self, other: &Self) -> bool { match (self, other) { (Self::Namespace(a), Self::Namespace(b)) => a == b, @@ -77,13 +77,13 @@ impl<'a> PartialEq for LibraryPathComponent<'a> { } } -impl<'a> PartialEq for LibraryPathComponent<'a> { +impl PartialEq for LibraryPathComponent<'_> { fn eq(&self, other: &str) -> bool { self.as_ref().eq(other) } } -impl<'a> AsRef for LibraryPathComponent<'a> { +impl AsRef for LibraryPathComponent<'_> { fn as_ref(&self) -> &str { match self { Self::Namespace(ns) => ns.as_str(), @@ -92,7 +92,7 @@ impl<'a> AsRef for LibraryPathComponent<'a> { } } -impl<'a> fmt::Display for LibraryPathComponent<'a> { +impl fmt::Display for LibraryPathComponent<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_ref()) } diff --git a/assembly/src/parser/mod.rs b/assembly/src/parser/mod.rs index d91f9e102..d61e5619a 100644 --- a/assembly/src/parser/mod.rs +++ b/assembly/src/parser/mod.rs @@ -304,7 +304,7 @@ mod module_walker { } } - impl<'a> Iterator for WalkModules<'a> { + impl Iterator for WalkModules<'_> { type Item = Result; fn next(&mut self) -> Option { diff --git a/assembly/src/parser/token.rs b/assembly/src/parser/token.rs index 825127871..602e27491 100644 --- a/assembly/src/parser/token.rs +++ b/assembly/src/parser/token.rs @@ -316,7 +316,7 @@ pub enum Token<'input> { Eof, } -impl<'input> fmt::Display for Token<'input> { +impl fmt::Display for Token<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Token::Add => write!(f, "add"), diff --git a/assembly/src/sema/passes/const_eval.rs b/assembly/src/sema/passes/const_eval.rs index f76de03ad..8394bc540 100644 --- a/assembly/src/sema/passes/const_eval.rs +++ b/assembly/src/sema/passes/const_eval.rs @@ -17,7 +17,7 @@ impl<'analyzer> ConstEvalVisitor<'analyzer> { } } -impl<'analyzer> ConstEvalVisitor<'analyzer> { +impl ConstEvalVisitor<'_> { fn eval_const(&mut self, imm: &mut Immediate) -> ControlFlow<()> where T: TryFrom, @@ -45,7 +45,7 @@ impl<'analyzer> ConstEvalVisitor<'analyzer> { } } -impl<'analyzer> VisitMut for ConstEvalVisitor<'analyzer> { +impl VisitMut for ConstEvalVisitor<'_> { fn visit_mut_immediate_u8(&mut self, imm: &mut Immediate) -> ControlFlow<()> { self.eval_const(imm) } diff --git a/assembly/src/sema/passes/verify_invoke.rs b/assembly/src/sema/passes/verify_invoke.rs index a1c38ba8c..16c7ac5ba 100644 --- a/assembly/src/sema/passes/verify_invoke.rs +++ b/assembly/src/sema/passes/verify_invoke.rs @@ -43,7 +43,7 @@ impl<'a> VerifyInvokeTargets<'a> { } } -impl<'a> VerifyInvokeTargets<'a> { +impl VerifyInvokeTargets<'_> { fn resolve_local(&mut self, name: &ProcedureName) -> ControlFlow<()> { if !self.procedures.contains(name) { self.analyzer @@ -72,7 +72,7 @@ impl<'a> VerifyInvokeTargets<'a> { } } -impl<'a> VisitMut for VerifyInvokeTargets<'a> { +impl VisitMut for VerifyInvokeTargets<'_> { fn visit_mut_inst(&mut self, inst: &mut Span) -> ControlFlow<()> { let span = inst.span(); match &**inst { diff --git a/core/src/mast/node/basic_block_node/mod.rs b/core/src/mast/node/basic_block_node/mod.rs index 81f0afa0a..726decbc7 100644 --- a/core/src/mast/node/basic_block_node/mod.rs +++ b/core/src/mast/node/basic_block_node/mod.rs @@ -247,7 +247,7 @@ struct BasicBlockNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> PrettyPrint for BasicBlockNodePrettyPrint<'a> { +impl PrettyPrint for BasicBlockNodePrettyPrint<'_> { #[rustfmt::skip] fn render(&self) -> crate::prettier::Document { use crate::prettier::*; @@ -295,7 +295,7 @@ impl<'a> PrettyPrint for BasicBlockNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for BasicBlockNodePrettyPrint<'a> { +impl fmt::Display for BasicBlockNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/node/call_node.rs b/core/src/mast/node/call_node.rs index c028a3245..7f207d386 100644 --- a/core/src/mast/node/call_node.rs +++ b/core/src/mast/node/call_node.rs @@ -201,7 +201,7 @@ struct CallNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> CallNodePrettyPrint<'a> { +impl CallNodePrettyPrint<'_> { /// Concatenates the provided decorators in a single line. If the list of decorators is not /// empty, prepends `prepend` and appends `append` to the decorator document. fn concatenate_decorators( @@ -240,7 +240,7 @@ impl<'a> CallNodePrettyPrint<'a> { } } -impl<'a> PrettyPrint for CallNodePrettyPrint<'a> { +impl PrettyPrint for CallNodePrettyPrint<'_> { fn render(&self) -> Document { let call_or_syscall = { let callee_digest = self.mast_forest[self.node.callee].digest(); @@ -265,7 +265,7 @@ impl<'a> PrettyPrint for CallNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for CallNodePrettyPrint<'a> { +impl fmt::Display for CallNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/node/dyn_node.rs b/core/src/mast/node/dyn_node.rs index 34e87610b..91afeea79 100644 --- a/core/src/mast/node/dyn_node.rs +++ b/core/src/mast/node/dyn_node.rs @@ -91,7 +91,7 @@ struct DynNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> DynNodePrettyPrint<'a> { +impl DynNodePrettyPrint<'_> { /// Concatenates the provided decorators in a single line. If the list of decorators is not /// empty, prepends `prepend` and appends `append` to the decorator document. fn concatenate_decorators( @@ -130,7 +130,7 @@ impl<'a> DynNodePrettyPrint<'a> { } } -impl<'a> crate::prettier::PrettyPrint for DynNodePrettyPrint<'a> { +impl crate::prettier::PrettyPrint for DynNodePrettyPrint<'_> { fn render(&self) -> crate::prettier::Document { let dyn_text = const_text("dyn"); @@ -144,7 +144,7 @@ impl<'a> crate::prettier::PrettyPrint for DynNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for DynNodePrettyPrint<'a> { +impl fmt::Display for DynNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.pretty_print(f) } diff --git a/core/src/mast/node/external.rs b/core/src/mast/node/external.rs index 3b3f23e40..d96600800 100644 --- a/core/src/mast/node/external.rs +++ b/core/src/mast/node/external.rs @@ -89,7 +89,7 @@ struct ExternalNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> ExternalNodePrettyPrint<'a> { +impl ExternalNodePrettyPrint<'_> { /// Concatenates the provided decorators in a single line. If the list of decorators is not /// empty, prepends `prepend` and appends `append` to the decorator document. fn concatenate_decorators( @@ -128,7 +128,7 @@ impl<'a> ExternalNodePrettyPrint<'a> { } } -impl<'a> crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'a> { +impl crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'_> { fn render(&self) -> crate::prettier::Document { let external = const_text("external") + const_text(".") @@ -144,7 +144,7 @@ impl<'a> crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for ExternalNodePrettyPrint<'a> { +impl fmt::Display for ExternalNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/node/join_node.rs b/core/src/mast/node/join_node.rs index 17aaccd8e..d3d04b451 100644 --- a/core/src/mast/node/join_node.rs +++ b/core/src/mast/node/join_node.rs @@ -142,7 +142,7 @@ struct JoinNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> PrettyPrint for JoinNodePrettyPrint<'a> { +impl PrettyPrint for JoinNodePrettyPrint<'_> { #[rustfmt::skip] fn render(&self) -> crate::prettier::Document { use crate::prettier::*; @@ -195,7 +195,7 @@ impl<'a> PrettyPrint for JoinNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for JoinNodePrettyPrint<'a> { +impl fmt::Display for JoinNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/node/loop_node.rs b/core/src/mast/node/loop_node.rs index 08933ac52..6091ce034 100644 --- a/core/src/mast/node/loop_node.rs +++ b/core/src/mast/node/loop_node.rs @@ -131,7 +131,7 @@ struct LoopNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> crate::prettier::PrettyPrint for LoopNodePrettyPrint<'a> { +impl crate::prettier::PrettyPrint for LoopNodePrettyPrint<'_> { fn render(&self) -> crate::prettier::Document { use crate::prettier::*; @@ -175,7 +175,7 @@ impl<'a> crate::prettier::PrettyPrint for LoopNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for LoopNodePrettyPrint<'a> { +impl fmt::Display for LoopNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/node/mod.rs b/core/src/mast/node/mod.rs index cbb3192f4..216356574 100644 --- a/core/src/mast/node/mod.rs +++ b/core/src/mast/node/mod.rs @@ -273,7 +273,7 @@ impl<'a> MastNodePrettyPrint<'a> { } } -impl<'a> PrettyPrint for MastNodePrettyPrint<'a> { +impl PrettyPrint for MastNodePrettyPrint<'_> { fn render(&self) -> Document { self.node_pretty_print.render() } @@ -289,7 +289,7 @@ impl<'a> MastNodeDisplay<'a> { } } -impl<'a> fmt::Display for MastNodeDisplay<'a> { +impl fmt::Display for MastNodeDisplay<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.node_display.fmt(f) } diff --git a/core/src/mast/node/split_node.rs b/core/src/mast/node/split_node.rs index 6b1b96e0c..8a46fcdc7 100644 --- a/core/src/mast/node/split_node.rs +++ b/core/src/mast/node/split_node.rs @@ -144,7 +144,7 @@ struct SplitNodePrettyPrint<'a> { mast_forest: &'a MastForest, } -impl<'a> PrettyPrint for SplitNodePrettyPrint<'a> { +impl PrettyPrint for SplitNodePrettyPrint<'_> { #[rustfmt::skip] fn render(&self) -> crate::prettier::Document { use crate::prettier::*; @@ -190,7 +190,7 @@ impl<'a> PrettyPrint for SplitNodePrettyPrint<'a> { } } -impl<'a> fmt::Display for SplitNodePrettyPrint<'a> { +impl fmt::Display for SplitNodePrettyPrint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use crate::prettier::PrettyPrint; self.pretty_print(f) diff --git a/core/src/mast/serialization/basic_blocks.rs b/core/src/mast/serialization/basic_blocks.rs index e32caa6e9..86cf88471 100644 --- a/core/src/mast/serialization/basic_blocks.rs +++ b/core/src/mast/serialization/basic_blocks.rs @@ -67,7 +67,7 @@ impl<'a> BasicBlockDataDecoder<'a> { } /// Decoding methods -impl<'a> BasicBlockDataDecoder<'a> { +impl BasicBlockDataDecoder<'_> { pub fn decode_operations_and_decorators( &self, ops_offset: NodeDataOffset, diff --git a/processor/src/host/advice/mod.rs b/processor/src/host/advice/mod.rs index 6dacc08b4..4eba93fe7 100644 --- a/processor/src/host/advice/mod.rs +++ b/processor/src/host/advice/mod.rs @@ -718,7 +718,7 @@ pub trait AdviceProvider: Sized { R: Borrow; } -impl<'a, T> AdviceProvider for &'a mut T +impl AdviceProvider for &mut T where T: AdviceProvider, { diff --git a/processor/src/host/mod.rs b/processor/src/host/mod.rs index 10366e7c6..4e4289b33 100644 --- a/processor/src/host/mod.rs +++ b/processor/src/host/mod.rs @@ -176,7 +176,7 @@ pub trait Host { } } -impl<'a, H> Host for &'a mut H +impl Host for &mut H where H: Host, { diff --git a/prover/src/gpu/metal/mod.rs b/prover/src/gpu/metal/mod.rs index ab7132834..27e124e3c 100644 --- a/prover/src/gpu/metal/mod.rs +++ b/prover/src/gpu/metal/mod.rs @@ -688,7 +688,7 @@ where E: FieldElement, I: IntoIterator>; -impl<'a, 'b, E, I, const N: usize> Iterator for SegmentIterator<'a, 'b, E, I, N> +impl Iterator for SegmentIterator<'_, '_, E, I, N> where E: FieldElement, I: IntoIterator>,