diff --git a/crates/bin/cairo-format/src/main.rs b/crates/bin/cairo-format/src/main.rs index 2793b2b8688..2a44df9be20 100644 --- a/crates/bin/cairo-format/src/main.rs +++ b/crates/bin/cairo-format/src/main.rs @@ -102,7 +102,7 @@ fn format_file_in_place(fmt: &CairoFormatter, args: &FormatterArgs, path: &Path) } } -impl<'t> ParallelVisitor for PathFormatter<'t> { +impl ParallelVisitor for PathFormatter<'_> { fn visit(&mut self, dir_entry_res: Result) -> WalkState { let dir_entry = if let Ok(dir_entry) = dir_entry_res { dir_entry diff --git a/crates/cairo-lang-casm/src/hints/mod.rs b/crates/cairo-lang-casm/src/hints/mod.rs index c3ec5dfd68a..70d66e15e0d 100644 --- a/crates/cairo-lang-casm/src/hints/mod.rs +++ b/crates/cairo-lang-casm/src/hints/mod.rs @@ -330,7 +330,7 @@ pub enum DeprecatedHint { } struct DerefOrImmediateFormatter<'a>(&'a DerefOrImmediate); -impl<'a> Display for DerefOrImmediateFormatter<'a> { +impl Display for DerefOrImmediateFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match self.0 { DerefOrImmediate::Deref(d) => write!(f, "memory{d}"), @@ -340,7 +340,7 @@ impl<'a> Display for DerefOrImmediateFormatter<'a> { } struct ResOperandAsIntegerFormatter<'a>(&'a ResOperand); -impl<'a> Display for ResOperandAsIntegerFormatter<'a> { +impl Display for ResOperandAsIntegerFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match self.0 { ResOperand::Deref(d) => write!(f, "memory{d}"), @@ -360,7 +360,7 @@ impl<'a> Display for ResOperandAsIntegerFormatter<'a> { } struct ResOperandAsAddressFormatter<'a>(&'a ResOperand); -impl<'a> Display for ResOperandAsAddressFormatter<'a> { +impl Display for ResOperandAsAddressFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match self.0 { ResOperand::Deref(d) => write!(f, "memory{d}"), diff --git a/crates/cairo-lang-compiler/src/diagnostics.rs b/crates/cairo-lang-compiler/src/diagnostics.rs index 067ea3b9e82..f83755c4cc0 100644 --- a/crates/cairo-lang-compiler/src/diagnostics.rs +++ b/crates/cairo-lang-compiler/src/diagnostics.rs @@ -25,7 +25,7 @@ trait DiagnosticCallback { fn on_diagnostic(&mut self, diagnostic: FormattedDiagnosticEntry); } -impl<'a> DiagnosticCallback for Option> { +impl DiagnosticCallback for Option> { fn on_diagnostic(&mut self, diagnostic: FormattedDiagnosticEntry) { if let Some(callback) = self { callback.on_diagnostic(diagnostic) diff --git a/crates/cairo-lang-filesystem/src/ids.rs b/crates/cairo-lang-filesystem/src/ids.rs index 17a66769dd0..41fc5988bdf 100644 --- a/crates/cairo-lang-filesystem/src/ids.rs +++ b/crates/cairo-lang-filesystem/src/ids.rs @@ -135,11 +135,11 @@ impl VirtualFile { } define_short_id!(FileId, FileLongId, FilesGroup, lookup_intern_file, intern_file); -impl<'b> FileId { +impl FileId { pub fn new(db: &dyn FilesGroup, path: PathBuf) -> FileId { FileLongId::OnDisk(path.clean()).intern(db) } - pub fn file_name(self, db: &'b dyn FilesGroup) -> String { + pub fn file_name(self, db: &dyn FilesGroup) -> String { match self.lookup_intern(db) { FileLongId::OnDisk(path) => { path.file_name().and_then(|x| x.to_str()).unwrap_or("").to_string() diff --git a/crates/cairo-lang-formatter/src/cairo_formatter.rs b/crates/cairo-lang-formatter/src/cairo_formatter.rs index f490b5d0165..00160166881 100644 --- a/crates/cairo-lang-formatter/src/cairo_formatter.rs +++ b/crates/cairo-lang-formatter/src/cairo_formatter.rs @@ -52,7 +52,7 @@ pub struct FileDiffColoredDisplay<'a> { diff: &'a FileDiff, } -impl<'a> Display for FileDiffColoredDisplay<'a> { +impl Display for FileDiffColoredDisplay<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let patch = create_patch(&self.diff.original, &self.diff.formatted); let patch_formatter = PatchFormatter::new().with_color(); @@ -61,7 +61,7 @@ impl<'a> Display for FileDiffColoredDisplay<'a> { } } -impl<'a> Debug for FileDiffColoredDisplay<'a> { +impl Debug for FileDiffColoredDisplay<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(f, "FileDiffColoredDisplay({:?})", self.diff) } diff --git a/crates/cairo-lang-lowering/src/borrow_check/mod.rs b/crates/cairo-lang-lowering/src/borrow_check/mod.rs index 3b91a320996..c09c9dc630a 100644 --- a/crates/cairo-lang-lowering/src/borrow_check/mod.rs +++ b/crates/cairo-lang-lowering/src/borrow_check/mod.rs @@ -82,7 +82,7 @@ impl DropPosition { } } -impl<'a> DemandReporter for BorrowChecker<'a> { +impl DemandReporter for BorrowChecker<'_> { // Note that for in BorrowChecker `IntroducePosition` is used to pass the cause of // the drop. type IntroducePosition = (Option, BlockId); @@ -163,7 +163,7 @@ impl<'a> DemandReporter for BorrowChecker<'a> { } } -impl<'a> Analyzer<'_> for BorrowChecker<'a> { +impl Analyzer<'_> for BorrowChecker<'_> { type Info = BorrowCheckerDemand; fn visit_stmt( diff --git a/crates/cairo-lang-lowering/src/destructs.rs b/crates/cairo-lang-lowering/src/destructs.rs index f447cede108..2265150ae03 100644 --- a/crates/cairo-lang-lowering/src/destructs.rs +++ b/crates/cairo-lang-lowering/src/destructs.rs @@ -67,7 +67,7 @@ struct PanicDeconstructionEntry { impl_id: ImplId, } -impl<'a> DestructAdder<'a> { +impl DestructAdder<'_> { /// Checks if the statement introduces a panic variable and sets the panic state accordingly. fn set_post_stmt_destruct( &mut self, @@ -117,7 +117,7 @@ impl<'a> DestructAdder<'a> { } } -impl<'a> DemandReporter for DestructAdder<'a> { +impl DemandReporter for DestructAdder<'_> { type IntroducePosition = StatementLocation; type UsePosition = (); @@ -200,7 +200,7 @@ pub enum PanicLocation { PanicMatch { match_block_id: BlockId, target_block_id: BlockId }, } -impl<'a> Analyzer<'_> for DestructAdder<'a> { +impl Analyzer<'_> for DestructAdder<'_> { type Info = DestructAdderDemand; fn visit_stmt( diff --git a/crates/cairo-lang-lowering/src/graph_algorithms/concrete_function_node.rs b/crates/cairo-lang-lowering/src/graph_algorithms/concrete_function_node.rs index 09020e078a7..ed075df4f7b 100644 --- a/crates/cairo-lang-lowering/src/graph_algorithms/concrete_function_node.rs +++ b/crates/cairo-lang-lowering/src/graph_algorithms/concrete_function_node.rs @@ -13,7 +13,7 @@ pub struct ConcreteFunctionWithBodyNode<'a> { pub db: &'a dyn LoweringGroup, pub dependency_type: DependencyType, } -impl<'a> GraphNode for ConcreteFunctionWithBodyNode<'a> { +impl GraphNode for ConcreteFunctionWithBodyNode<'_> { type NodeId = ConcreteFunctionWithBodyId; fn get_neighbors(&self) -> Vec { @@ -37,7 +37,7 @@ impl<'a> GraphNode for ConcreteFunctionWithBodyNode<'a> { self.function_id } } -impl<'a> ComputeScc for ConcreteFunctionWithBodyNode<'a> { +impl ComputeScc for ConcreteFunctionWithBodyNode<'_> { fn compute_scc(&self) -> Vec { concrete_function_with_body_scc(self.db, self.function_id, self.dependency_type) } @@ -49,7 +49,7 @@ pub struct ConcreteFunctionWithBodyPostPanicNode<'a> { pub db: &'a dyn LoweringGroup, pub dependency_type: DependencyType, } -impl<'a> GraphNode for ConcreteFunctionWithBodyPostPanicNode<'a> { +impl GraphNode for ConcreteFunctionWithBodyPostPanicNode<'_> { type NodeId = ConcreteFunctionWithBodyId; fn get_neighbors(&self) -> Vec { @@ -75,7 +75,7 @@ impl<'a> GraphNode for ConcreteFunctionWithBodyPostPanicNode<'a> { self.function_id } } -impl<'a> ComputeScc for ConcreteFunctionWithBodyPostPanicNode<'a> { +impl ComputeScc for ConcreteFunctionWithBodyPostPanicNode<'_> { fn compute_scc(&self) -> Vec { concrete_function_with_body_scc(self.db, self.function_id, self.dependency_type) } diff --git a/crates/cairo-lang-lowering/src/inline/mod.rs b/crates/cairo-lang-lowering/src/inline/mod.rs index 319c44405e1..94da339f423 100644 --- a/crates/cairo-lang-lowering/src/inline/mod.rs +++ b/crates/cairo-lang-lowering/src/inline/mod.rs @@ -180,7 +180,7 @@ pub struct Mapper<'a, 'b> { block_id_offset: BlockId, } -impl<'a, 'b> Rebuilder for Mapper<'a, 'b> { +impl Rebuilder for Mapper<'_, '_> { /// Maps a var id from the original lowering representation to the equivalent id in the /// new lowering representation. /// If the variable wasn't assigned an id yet, a new id is assigned. diff --git a/crates/cairo-lang-lowering/src/inline/statements_weights.rs b/crates/cairo-lang-lowering/src/inline/statements_weights.rs index e80fffdb1b7..678bd4a3554 100644 --- a/crates/cairo-lang-lowering/src/inline/statements_weights.rs +++ b/crates/cairo-lang-lowering/src/inline/statements_weights.rs @@ -71,7 +71,7 @@ impl<'a> ApproxCasmInlineWeight<'a> { } } -impl<'a> InlineWeight for ApproxCasmInlineWeight<'a> { +impl InlineWeight for ApproxCasmInlineWeight<'_> { fn calling_weight(&self, _lowered: &FlatLowered) -> isize { 0 } diff --git a/crates/cairo-lang-lowering/src/lower/block_builder.rs b/crates/cairo-lang-lowering/src/lower/block_builder.rs index b7606bd9ad4..f63aebf69bc 100644 --- a/crates/cairo-lang-lowering/src/lower/block_builder.rs +++ b/crates/cairo-lang-lowering/src/lower/block_builder.rs @@ -488,7 +488,7 @@ struct BlockStructRecomposer<'a, 'b, 'c> { ctx: &'a mut LoweringContext<'b, 'c>, location: LocationId, } -impl<'a, 'b, 'c> StructRecomposer for BlockStructRecomposer<'a, 'b, 'c> { +impl StructRecomposer for BlockStructRecomposer<'_, '_, '_> { fn deconstruct( &mut self, concrete_struct_id: semantic::ConcreteStructId, diff --git a/crates/cairo-lang-lowering/src/lower/context.rs b/crates/cairo-lang-lowering/src/lower/context.rs index 4486087b001..42af39b3ff1 100644 --- a/crates/cairo-lang-lowering/src/lower/context.rs +++ b/crates/cairo-lang-lowering/src/lower/context.rs @@ -75,7 +75,7 @@ impl<'db> VariableAllocator<'db> { LocationId::from_stable_location(self.db, StableLocation::new(stable_ptr)) } } -impl<'db> Index for VariableAllocator<'db> { +impl Index for VariableAllocator<'_> { type Output = Variable; fn index(&self, index: VariableId) -> &Self::Output { @@ -165,19 +165,19 @@ impl<'a, 'db> LoweringContext<'a, 'db> { }) } } -impl<'a, 'db> Deref for LoweringContext<'a, 'db> { +impl<'db> Deref for LoweringContext<'_, 'db> { type Target = EncapsulatingLoweringContext<'db>; fn deref(&self) -> &Self::Target { self.encapsulating_ctx.as_ref().unwrap() } } -impl<'a, 'db> DerefMut for LoweringContext<'a, 'db> { +impl DerefMut for LoweringContext<'_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { self.encapsulating_ctx.as_mut().unwrap() } } -impl<'a, 'db> LoweringContext<'a, 'db> { +impl LoweringContext<'_, '_> { /// Allocates a new variable in the context's variable arena according to the context. pub fn new_var(&mut self, req: VarRequest) -> VariableId { self.variables.new_var(req) diff --git a/crates/cairo-lang-lowering/src/optimizations/const_folding.rs b/crates/cairo-lang-lowering/src/optimizations/const_folding.rs index 109f005b73b..8c935179b6b 100644 --- a/crates/cairo-lang-lowering/src/optimizations/const_folding.rs +++ b/crates/cairo-lang-lowering/src/optimizations/const_folding.rs @@ -111,7 +111,7 @@ pub fn const_folding(db: &dyn LoweringGroup, lowered: &mut FlatLowered) { ctx.variables[input.var_id] .copyable .is_ok() - .then(|| VarInfo::Var(*input)), + .then_some(VarInfo::Var(*input)), ); continue; }; @@ -219,7 +219,7 @@ struct ConstFoldingContext<'a> { libfunc_info: &'a ConstFoldingLibfuncInfo, } -impl<'a> ConstFoldingContext<'a> { +impl ConstFoldingContext<'_> { /// Handles a statement call. /// /// Returns None if no additional changes are required. diff --git a/crates/cairo-lang-lowering/src/panic/mod.rs b/crates/cairo-lang-lowering/src/panic/mod.rs index 55e81549bd2..b59111ae0eb 100644 --- a/crates/cairo-lang-lowering/src/panic/mod.rs +++ b/crates/cairo-lang-lowering/src/panic/mod.rs @@ -138,7 +138,7 @@ struct PanicLoweringContext<'a> { flat_blocks: FlatBlocksBuilder, panic_info: PanicSignatureInfo, } -impl<'a> PanicLoweringContext<'a> { +impl PanicLoweringContext<'_> { pub fn db(&self) -> &dyn LoweringGroup { self.variables.db } diff --git a/crates/cairo-lang-lowering/src/scc/mod.rs b/crates/cairo-lang-lowering/src/scc/mod.rs index 77a6f4963cf..62f3000da8e 100644 --- a/crates/cairo-lang-lowering/src/scc/mod.rs +++ b/crates/cairo-lang-lowering/src/scc/mod.rs @@ -25,7 +25,7 @@ struct FunctionWithBodyNode<'a> { dependency_type: DependencyType, db: &'a dyn LoweringGroup, } -impl<'a> GraphNode for FunctionWithBodyNode<'a> { +impl GraphNode for FunctionWithBodyNode<'_> { type NodeId = FunctionWithBodyId; fn get_neighbors(&self) -> Vec { diff --git a/crates/cairo-lang-parser/src/colored_printer.rs b/crates/cairo-lang-parser/src/colored_printer.rs index b83277b86ff..4fdfcc3328f 100644 --- a/crates/cairo-lang-parser/src/colored_printer.rs +++ b/crates/cairo-lang-parser/src/colored_printer.rs @@ -11,7 +11,7 @@ struct ColoredPrinter<'a> { verbose: bool, result: String, } -impl<'a> ColoredPrinter<'a> { +impl ColoredPrinter<'_> { fn print(&mut self, syntax_node: &SyntaxNode) { let node = syntax_node.green_node(self.db); match &node.details { diff --git a/crates/cairo-lang-parser/src/lexer.rs b/crates/cairo-lang-parser/src/lexer.rs index b86659a01b3..f729e5c4ff8 100644 --- a/crates/cairo-lang-parser/src/lexer.rs +++ b/crates/cairo-lang-parser/src/lexer.rs @@ -124,8 +124,8 @@ impl<'a> Lexer<'a> { } } - /// Token matchers. - /// ================================================================================= + // Token matchers. + // ================================================================================= /// Takes a number. May be decimal, hex, oct or bin. fn take_token_literal_number(&mut self) -> TokenKind { diff --git a/crates/cairo-lang-plugins/src/plugins/config.rs b/crates/cairo-lang-plugins/src/plugins/config.rs index 6127e959bff..719324a37c3 100644 --- a/crates/cairo-lang-plugins/src/plugins/config.rs +++ b/crates/cairo-lang-plugins/src/plugins/config.rs @@ -66,7 +66,7 @@ pub struct ItemsInCfg<'a, Item: QueryAttrs> { iterator: as IntoIterator>::IntoIter, } -impl<'a, Item: QueryAttrs> Iterator for ItemsInCfg<'a, Item> { +impl Iterator for ItemsInCfg<'_, Item> { type Item = Item; fn next(&mut self) -> Option { diff --git a/crates/cairo-lang-runner/src/casm_run/mod.rs b/crates/cairo-lang-runner/src/casm_run/mod.rs index 5197ab51afb..bc1bf9f9844 100644 --- a/crates/cairo-lang-runner/src/casm_run/mod.rs +++ b/crates/cairo-lang-runner/src/casm_run/mod.rs @@ -620,13 +620,13 @@ impl<'a> MemBuffer<'a> { } } -impl<'a> VMWrapper for MemBuffer<'a> { +impl VMWrapper for MemBuffer<'_> { fn vm(&mut self) -> &mut VirtualMachine { self.vm.vm() } } -impl<'a> CairoHintProcessor<'a> { +impl CairoHintProcessor<'_> { /// Executes a syscall. fn execute_syscall( &mut self, diff --git a/crates/cairo-lang-semantic/src/expr/fmt.rs b/crates/cairo-lang-semantic/src/expr/fmt.rs index c736ed3eddd..aadb4500695 100644 --- a/crates/cairo-lang-semantic/src/expr/fmt.rs +++ b/crates/cairo-lang-semantic/src/expr/fmt.rs @@ -11,12 +11,12 @@ pub struct ExprFormatter<'a> { pub function_id: FunctionWithBodyId, } -impl<'a> Upcast for ExprFormatter<'a> { +impl Upcast for ExprFormatter<'_> { fn upcast(&self) -> &(dyn SemanticGroup + 'static) { self.db } } -impl<'a> Upcast for ExprFormatter<'a> { +impl Upcast for ExprFormatter<'_> { fn upcast(&self) -> &(dyn DefsGroup + 'static) { self.db.upcast() } diff --git a/crates/cairo-lang-semantic/src/expr/inference.rs b/crates/cairo-lang-semantic/src/expr/inference.rs index e27c9ca9720..c97c6cb8ccf 100644 --- a/crates/cairo-lang-semantic/src/expr/inference.rs +++ b/crates/cairo-lang-semantic/src/expr/inference.rs @@ -456,7 +456,7 @@ impl DerefMut for Inference<'_> { } } -impl<'db> std::fmt::Debug for Inference<'db> { +impl std::fmt::Debug for Inference<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let x = self.data.debug(self.db.elongate()); write!(f, "{x:?}") @@ -1113,7 +1113,7 @@ impl<'a> HasDb<&'a dyn SemanticGroup> for Inference<'a> { add_basic_rewrites!(<'a>, Inference<'a>, NoError, @exclude TypeLongId TypeId ImplLongId ImplId ConstValue); add_expr_rewrites!(<'a>, Inference<'a>, NoError, @exclude); add_rewrite!(<'a>, Inference<'a>, NoError, Ambiguity); -impl<'a> SemanticRewriter for Inference<'a> { +impl SemanticRewriter for Inference<'_> { fn internal_rewrite(&mut self, value: &mut TypeId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -1121,7 +1121,7 @@ impl<'a> SemanticRewriter for Inference<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Inference<'a> { +impl SemanticRewriter for Inference<'_> { fn internal_rewrite(&mut self, value: &mut ImplId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -1129,7 +1129,7 @@ impl<'a> SemanticRewriter for Inference<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Inference<'a> { +impl SemanticRewriter for Inference<'_> { fn internal_rewrite(&mut self, value: &mut TypeLongId) -> Result { match value { TypeLongId::Var(var) => { @@ -1197,7 +1197,7 @@ impl<'a> SemanticRewriter for Inference<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Inference<'a> { +impl SemanticRewriter for Inference<'_> { fn internal_rewrite(&mut self, value: &mut ConstValue) -> Result { match value { ConstValue::Var(var, _) => { @@ -1250,7 +1250,7 @@ impl<'a> SemanticRewriter for Inference<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Inference<'a> { +impl SemanticRewriter for Inference<'_> { fn internal_rewrite(&mut self, value: &mut ImplLongId) -> Result { match value { ImplLongId::ImplVar(var) => { @@ -1328,7 +1328,7 @@ impl<'a> HasDb<&'a dyn SemanticGroup> for InferenceIdReplacer<'a> { add_basic_rewrites!(<'a>, InferenceIdReplacer<'a>, NoError, @exclude InferenceId); add_expr_rewrites!(<'a>, InferenceIdReplacer<'a>, NoError, @exclude); add_rewrite!(<'a>, InferenceIdReplacer<'a>, NoError, Ambiguity); -impl<'a> SemanticRewriter for InferenceIdReplacer<'a> { +impl SemanticRewriter for InferenceIdReplacer<'_> { fn internal_rewrite(&mut self, value: &mut InferenceId) -> Result { if value == &self.from_inference_id { *value = self.to_inference_id; diff --git a/crates/cairo-lang-semantic/src/expr/inference/canonic.rs b/crates/cairo-lang-semantic/src/expr/inference/canonic.rs index 472e00751f0..7bec87d48c6 100644 --- a/crates/cairo-lang-semantic/src/expr/inference/canonic.rs +++ b/crates/cairo-lang-semantic/src/expr/inference/canonic.rs @@ -191,7 +191,7 @@ add_basic_rewrites!( @exclude TypeLongId TypeId ImplLongId ImplId ConstValue ); -impl<'a> SemanticRewriter for Canonicalizer<'a> { +impl SemanticRewriter for Canonicalizer<'_> { fn internal_rewrite(&mut self, value: &mut TypeId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -199,7 +199,7 @@ impl<'a> SemanticRewriter for Canonicalizer<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Canonicalizer<'a> { +impl SemanticRewriter for Canonicalizer<'_> { fn internal_rewrite(&mut self, value: &mut TypeLongId) -> Result { let TypeLongId::Var(var) = value else { return value.default_rewrite(self); @@ -215,7 +215,7 @@ impl<'a> SemanticRewriter for Canonicalizer<'a> { Ok(RewriteResult::Modified) } } -impl<'a> SemanticRewriter for Canonicalizer<'a> { +impl SemanticRewriter for Canonicalizer<'_> { fn internal_rewrite(&mut self, value: &mut ConstValue) -> Result { let ConstValue::Var(var, mut ty) = value else { return value.default_rewrite(self); @@ -235,7 +235,7 @@ impl<'a> SemanticRewriter for Canonicalizer<'a> { Ok(RewriteResult::Modified) } } -impl<'a> SemanticRewriter for Canonicalizer<'a> { +impl SemanticRewriter for Canonicalizer<'_> { fn internal_rewrite(&mut self, value: &mut ImplId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -243,7 +243,7 @@ impl<'a> SemanticRewriter for Canonicalizer<'a> { value.default_rewrite(self) } } -impl<'a> SemanticRewriter for Canonicalizer<'a> { +impl SemanticRewriter for Canonicalizer<'_> { fn internal_rewrite(&mut self, value: &mut ImplLongId) -> Result { let ImplLongId::ImplVar(var_id) = value else { if value.is_var_free(self.db) { @@ -287,7 +287,7 @@ impl<'a, 'db> Embedder<'a, 'db> { } } -impl<'a, 'b> HasDb<&'a dyn SemanticGroup> for Embedder<'a, 'b> { +impl<'a> HasDb<&'a dyn SemanticGroup> for Embedder<'a, '_> { fn get_db(&self) -> &'a dyn SemanticGroup { self.inference.db } @@ -300,7 +300,7 @@ add_basic_rewrites!( @exclude TypeLongId TypeId ConstValue ImplLongId ImplId ); -impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { +impl SemanticRewriter for Embedder<'_, '_> { fn internal_rewrite(&mut self, value: &mut TypeId) -> Result { if value.is_var_free(self.get_db()) { return Ok(RewriteResult::NoChange); @@ -308,7 +308,7 @@ impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { value.default_rewrite(self) } } -impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { +impl SemanticRewriter for Embedder<'_, '_> { fn internal_rewrite(&mut self, value: &mut TypeLongId) -> Result { let TypeLongId::Var(var) = value else { return value.default_rewrite(self); @@ -325,7 +325,7 @@ impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { Ok(RewriteResult::Modified) } } -impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { +impl SemanticRewriter for Embedder<'_, '_> { fn internal_rewrite(&mut self, value: &mut ConstValue) -> Result { let ConstValue::Var(var, mut ty) = value else { return value.default_rewrite(self); @@ -343,7 +343,7 @@ impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { Ok(RewriteResult::Modified) } } -impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { +impl SemanticRewriter for Embedder<'_, '_> { fn internal_rewrite(&mut self, value: &mut ImplId) -> Result { if value.is_var_free(self.get_db()) { return Ok(RewriteResult::NoChange); @@ -351,7 +351,7 @@ impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { value.default_rewrite(self) } } -impl<'a, 'b> SemanticRewriter for Embedder<'a, 'b> { +impl SemanticRewriter for Embedder<'_, '_> { fn internal_rewrite(&mut self, value: &mut ImplLongId) -> Result { let ImplLongId::ImplVar(var_id) = value else { if value.is_var_free(self.get_db()) { @@ -406,7 +406,7 @@ add_basic_rewrites!( @exclude TypeLongId TypeId ImplLongId ImplId ConstValue ); -impl<'db> SemanticRewriter for Mapper<'db> { +impl SemanticRewriter for Mapper<'_> { fn internal_rewrite(&mut self, value: &mut TypeId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -414,7 +414,7 @@ impl<'db> SemanticRewriter for Mapper<'db> { value.default_rewrite(self) } } -impl<'db> SemanticRewriter for Mapper<'db> { +impl SemanticRewriter for Mapper<'_> { fn internal_rewrite(&mut self, value: &mut TypeLongId) -> Result { let TypeLongId::Var(var) = value else { return value.default_rewrite(self); @@ -429,7 +429,7 @@ impl<'db> SemanticRewriter for Mapper<'db> { Ok(RewriteResult::Modified) } } -impl<'db> SemanticRewriter for Mapper<'db> { +impl SemanticRewriter for Mapper<'_> { fn internal_rewrite(&mut self, value: &mut ConstValue) -> Result { let ConstValue::Var(var, mut ty) = value else { return value.default_rewrite(self); @@ -446,7 +446,7 @@ impl<'db> SemanticRewriter for Mapper<'db> { Ok(RewriteResult::Modified) } } -impl<'db> SemanticRewriter for Mapper<'db> { +impl SemanticRewriter for Mapper<'_> { fn internal_rewrite(&mut self, value: &mut ImplId) -> Result { if value.is_var_free(self.db) { return Ok(RewriteResult::NoChange); @@ -454,7 +454,7 @@ impl<'db> SemanticRewriter for Mapper<'db> { value.default_rewrite(self) } } -impl<'db> SemanticRewriter for Mapper<'db> { +impl SemanticRewriter for Mapper<'_> { fn internal_rewrite(&mut self, value: &mut ImplLongId) -> Result { let ImplLongId::ImplVar(var_id) = value else { return value.default_rewrite(self); diff --git a/crates/cairo-lang-semantic/src/expr/inference/conform.rs b/crates/cairo-lang-semantic/src/expr/inference/conform.rs index 59a0cb56d12..9144dfaf472 100644 --- a/crates/cairo-lang-semantic/src/expr/inference/conform.rs +++ b/crates/cairo-lang-semantic/src/expr/inference/conform.rs @@ -68,7 +68,7 @@ pub trait InferenceConform { fn function_contains_var(&mut self, function_id: FunctionId, var: InferenceVar) -> bool; } -impl<'db> InferenceConform for Inference<'db> { +impl InferenceConform for Inference<'_> { /// Conforms ty0 to ty1. Should be called when ty0 should be coerced to ty1. Not symmetric. /// Returns the reduced type for ty0, or an error if the type is no coercible. fn conform_ty(&mut self, ty0: TypeId, ty1: TypeId) -> InferenceResult { diff --git a/crates/cairo-lang-semantic/src/expr/inference/infers.rs b/crates/cairo-lang-semantic/src/expr/inference/infers.rs index 9e23c39ed0a..c8bc3f3adbe 100644 --- a/crates/cairo-lang-semantic/src/expr/inference/infers.rs +++ b/crates/cairo-lang-semantic/src/expr/inference/infers.rs @@ -113,7 +113,7 @@ pub trait InferenceEmbeddings { ) -> ImplImplId; } -impl<'db> InferenceEmbeddings for Inference<'db> { +impl InferenceEmbeddings for Inference<'_> { /// Infers all the variables required to make an uninferred impl provide a concrete trait. fn infer_impl( &mut self, diff --git a/crates/cairo-lang-semantic/src/substitution.rs b/crates/cairo-lang-semantic/src/substitution.rs index 1bde2a5c850..e83ac1fb397 100644 --- a/crates/cairo-lang-semantic/src/substitution.rs +++ b/crates/cairo-lang-semantic/src/substitution.rs @@ -445,7 +445,7 @@ add_basic_rewrites!( @exclude TypeId TypeLongId ImplId ImplLongId ConstValue GenericFunctionId ); -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut TypeId) -> Maybe { if value.is_fully_concrete(self.db) { return Ok(RewriteResult::NoChange); @@ -454,7 +454,7 @@ impl<'a> SemanticRewriter for SubstitutionRewriter<'a> } } -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut ImplId) -> Maybe { if value.is_fully_concrete(self.db) { return Ok(RewriteResult::NoChange); @@ -463,7 +463,7 @@ impl<'a> SemanticRewriter for SubstitutionRewriter<'a> } } -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut TypeLongId) -> Maybe { match value { TypeLongId::GenericParameter(generic_param) => { @@ -502,7 +502,7 @@ impl<'a> SemanticRewriter for SubstitutionRewriter< value.default_rewrite(self) } } -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut ConstValue) -> Maybe { match value { ConstValue::Generic(param_id) => { @@ -548,7 +548,7 @@ impl<'a> SemanticRewriter for SubstitutionRewriter< value.default_rewrite(self) } } -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut ImplLongId) -> Maybe { match value { ImplLongId::GenericParameter(generic_param) => { @@ -589,7 +589,7 @@ impl<'a> SemanticRewriter for SubstitutionRewriter< value.default_rewrite(self) } } -impl<'a> SemanticRewriter for SubstitutionRewriter<'a> { +impl SemanticRewriter for SubstitutionRewriter<'_> { fn internal_rewrite(&mut self, value: &mut GenericFunctionId) -> Maybe { if let GenericFunctionId::Trait(id) = value { if let Some(self_impl) = &self.substitution.self_impl { diff --git a/crates/cairo-lang-sierra-ap-change/src/compute.rs b/crates/cairo-lang-sierra-ap-change/src/compute.rs index 05d6e1de014..24c78a7518c 100644 --- a/crates/cairo-lang-sierra-ap-change/src/compute.rs +++ b/crates/cairo-lang-sierra-ap-change/src/compute.rs @@ -21,8 +21,8 @@ struct InvocationApChangeInfoProviderForEqGen<'a, TokenUsages: Fn(CostTokenType) token_usages: TokenUsages, } -impl<'a, TokenUsages: Fn(CostTokenType) -> usize> InvocationApChangeInfoProvider - for InvocationApChangeInfoProviderForEqGen<'a, TokenUsages> +impl usize> InvocationApChangeInfoProvider + for InvocationApChangeInfoProviderForEqGen<'_, TokenUsages> { fn type_size(&self, ty: &ConcreteTypeId) -> usize { self.type_sizes[ty].into_or_panic() diff --git a/crates/cairo-lang-sierra-ap-change/src/lib.rs b/crates/cairo-lang-sierra-ap-change/src/lib.rs index 0f7bcfa39fc..29fd84376a5 100644 --- a/crates/cairo-lang-sierra-ap-change/src/lib.rs +++ b/crates/cairo-lang-sierra-ap-change/src/lib.rs @@ -68,8 +68,8 @@ struct InvocationApChangeInfoProviderForEqGen<'a, TokenUsages: Fn(CostTokenType) token_usages: TokenUsages, } -impl<'a, TokenUsages: Fn(CostTokenType) -> usize> InvocationApChangeInfoProvider - for InvocationApChangeInfoProviderForEqGen<'a, TokenUsages> +impl usize> InvocationApChangeInfoProvider + for InvocationApChangeInfoProviderForEqGen<'_, TokenUsages> { fn type_size(&self, ty: &ConcreteTypeId) -> usize { self.type_sizes[ty].into_or_panic() diff --git a/crates/cairo-lang-sierra-gas/src/compute_costs.rs b/crates/cairo-lang-sierra-gas/src/compute_costs.rs index 27cfae5488c..cc57791be46 100644 --- a/crates/cairo-lang-sierra-gas/src/compute_costs.rs +++ b/crates/cairo-lang-sierra-gas/src/compute_costs.rs @@ -410,7 +410,7 @@ struct CostContext<'a, CostType: CostTypeTrait> { /// A partial map from StatementIdx to a requested lower bound on the wallet value. target_values: UnorderedHashMap, } -impl<'a, CostType: CostTypeTrait> CostContext<'a, CostType> { +impl CostContext<'_, CostType> { /// Returns the cost of a libfunc for every output branch. fn get_cost(&self, libfunc_id: &ConcreteLibfuncId) -> Vec { (self.get_cost_fn)(libfunc_id) @@ -782,7 +782,7 @@ pub struct PostcostContext<'a> { pub precost_gas_info: &'a GasInfo, } -impl<'a, CostType: PostCostTypeEx> SpecificCostContextTrait for PostcostContext<'a> { +impl SpecificCostContextTrait for PostcostContext<'_> { fn to_cost_map(cost: CostType) -> OrderedHashMap { if cost == CostType::default() { Default::default() } else { Self::to_full_cost_map(cost) } } @@ -860,7 +860,7 @@ impl<'a, CostType: PostCostTypeEx> SpecificCostContextTrait for Postco } } -impl<'a> PostcostContext<'a> { +impl PostcostContext<'_> { /// Computes the cost of the withdraw_gas libfunc. fn compute_withdraw_gas_cost( &self, diff --git a/crates/cairo-lang-sierra-gas/src/lib.rs b/crates/cairo-lang-sierra-gas/src/lib.rs index cc5fed42877..d468dc594e0 100644 --- a/crates/cairo-lang-sierra-gas/src/lib.rs +++ b/crates/cairo-lang-sierra-gas/src/lib.rs @@ -68,9 +68,9 @@ struct InvocationCostInfoProviderForEqGen< ap_change_var_value: ApChangeVarValue, } -impl<'a, TokenUsages: Fn(CostTokenType) -> usize, ApChangeVarValue: Fn() -> usize> +impl usize, ApChangeVarValue: Fn() -> usize> InvocationCostInfoProvider - for InvocationCostInfoProviderForEqGen<'a, TokenUsages, ApChangeVarValue> + for InvocationCostInfoProviderForEqGen<'_, TokenUsages, ApChangeVarValue> { fn type_size(&self, ty: &ConcreteTypeId) -> usize { self.type_sizes[ty].into_or_panic() diff --git a/crates/cairo-lang-sierra-generator/src/lifetime.rs b/crates/cairo-lang-sierra-generator/src/lifetime.rs index ca82e6c189c..82f739431ac 100644 --- a/crates/cairo-lang-sierra-generator/src/lifetime.rs +++ b/crates/cairo-lang-sierra-generator/src/lifetime.rs @@ -160,7 +160,7 @@ impl AuxCombine for ReturnState { type SierraDemand = Demand; -impl<'a> DemandReporter for VariableLifetimeContext<'a> { +impl DemandReporter for VariableLifetimeContext<'_> { type IntroducePosition = DropLocation; type UsePosition = UseLocation; @@ -178,7 +178,7 @@ impl<'a> DemandReporter for VariableLifetimeContext<' } } -impl<'a> Analyzer<'_> for VariableLifetimeContext<'a> { +impl Analyzer<'_> for VariableLifetimeContext<'_> { type Info = SierraDemand; fn visit_stmt( @@ -275,7 +275,7 @@ impl<'a> Analyzer<'_> for VariableLifetimeContext<'a> { info } } -impl<'a> VariableLifetimeContext<'a> { +impl VariableLifetimeContext<'_> { /// A wrapper for info.variables_introduced that adds demand for uninitialized locals. /// Note that this function is not called for the parameters of the analyzed function. fn introduce( diff --git a/crates/cairo-lang-sierra-generator/src/local_variables.rs b/crates/cairo-lang-sierra-generator/src/local_variables.rs index 76c18eefd3f..5da5d86c6b3 100644 --- a/crates/cairo-lang-sierra-generator/src/local_variables.rs +++ b/crates/cairo-lang-sierra-generator/src/local_variables.rs @@ -139,11 +139,11 @@ struct AnalysisInfo { demand: LoweredDemand, known_ap_change: bool, } -impl<'a> DemandReporter for FindLocalsContext<'a> { +impl DemandReporter for FindLocalsContext<'_> { type UsePosition = (); type IntroducePosition = (); } -impl<'a> Analyzer<'_> for FindLocalsContext<'a> { +impl Analyzer<'_> for FindLocalsContext<'_> { type Info = Maybe; fn visit_stmt( diff --git a/crates/cairo-lang-sierra-generator/src/pre_sierra.rs b/crates/cairo-lang-sierra-generator/src/pre_sierra.rs index 5d36b0ad179..58b7daca61c 100644 --- a/crates/cairo-lang-sierra-generator/src/pre_sierra.rs +++ b/crates/cairo-lang-sierra-generator/src/pre_sierra.rs @@ -25,7 +25,7 @@ pub struct LabelIdWithDb<'db> { db: &'db dyn SierraGenGroup, label_id: LabelId, } -impl<'db> std::fmt::Display for LabelIdWithDb<'db> { +impl std::fmt::Display for LabelIdWithDb<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let LabelLongId { parent, id } = self.label_id.lookup_intern(self.db); let parent = parent.function_id(self.db.upcast()).unwrap(); @@ -95,7 +95,7 @@ struct StatementWithDb<'db> { db: &'db dyn SierraGenGroup, statement: Statement, } -impl<'db> std::fmt::Display for StatementWithDb<'db> { +impl std::fmt::Display for StatementWithDb<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match &self.statement { Statement::Sierra(value) => { diff --git a/crates/cairo-lang-sierra-to-casm/src/invocations/mod.rs b/crates/cairo-lang-sierra-to-casm/src/invocations/mod.rs index ac4274636c8..434629c8dcf 100644 --- a/crates/cairo-lang-sierra-to-casm/src/invocations/mod.rs +++ b/crates/cairo-lang-sierra-to-casm/src/invocations/mod.rs @@ -309,7 +309,7 @@ type VarCells = [Var]; /// The configuration for all Sierra variables returned from a libfunc. type AllVars<'a> = [&'a VarCells]; -impl<'a> InvocationApChangeInfoProvider for CompiledInvocationBuilder<'a> { +impl InvocationApChangeInfoProvider for CompiledInvocationBuilder<'_> { fn type_size(&self, ty: &ConcreteTypeId) -> usize { self.program_info.type_sizes[ty] as usize } @@ -325,7 +325,7 @@ impl<'a> InvocationApChangeInfoProvider for CompiledInvocationBuilder<'a> { } } -impl<'a> InvocationCostInfoProvider for CompiledInvocationBuilder<'a> { +impl InvocationCostInfoProvider for CompiledInvocationBuilder<'_> { fn type_size(&self, ty: &ConcreteTypeId) -> usize { self.program_info.type_sizes[ty] as usize } diff --git a/crates/cairo-lang-sierra-to-casm/src/test_utils.rs b/crates/cairo-lang-sierra-to-casm/src/test_utils.rs index 9b92c049f63..36e844a09f6 100644 --- a/crates/cairo-lang-sierra-to-casm/src/test_utils.rs +++ b/crates/cairo-lang-sierra-to-casm/src/test_utils.rs @@ -13,9 +13,6 @@ pub fn read_sierra_example_file(name: &str) -> String { /// Removes all comments and empty lines from the given program. pub fn strip_comments_and_linebreaks(program: &str) -> String { - return program - .split('\n') - .filter(|line| !(line.is_empty() || line.starts_with("//"))) - .join("\n") - + "\n"; + program.split('\n').filter(|line| !(line.is_empty() || line.starts_with("//"))).join("\n") + + "\n" } diff --git a/crates/cairo-lang-syntax/src/node/iter.rs b/crates/cairo-lang-syntax/src/node/iter.rs index 54d1f65d503..16521df5a74 100644 --- a/crates/cairo-lang-syntax/src/node/iter.rs +++ b/crates/cairo-lang-syntax/src/node/iter.rs @@ -50,7 +50,7 @@ impl<'a> Preorder<'a> { } } -impl<'a> Iterator for Preorder<'a> { +impl Iterator for Preorder<'_> { type Item = WalkEvent; fn next(&mut self) -> Option { diff --git a/crates/cairo-lang-syntax/src/node/mod.rs b/crates/cairo-lang-syntax/src/node/mod.rs index 32287e64073..70a127a2d3b 100644 --- a/crates/cairo-lang-syntax/src/node/mod.rs +++ b/crates/cairo-lang-syntax/src/node/mod.rs @@ -339,7 +339,7 @@ pub struct NodeTextFormatter<'a> { /// The syntax db. pub db: &'a dyn SyntaxGroup, } -impl<'a> Display for NodeTextFormatter<'a> { +impl Display for NodeTextFormatter<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match &self.node.green_node(self.db).as_ref().details { green::GreenNodeDetails::Token(text) => write!(f, "{text}")?,