From cf7b980833f57429c32f8d5d61027b8008bf3f3e Mon Sep 17 00:00:00 2001 From: Malatrax Date: Fri, 25 Oct 2024 10:48:57 +0200 Subject: [PATCH] chore: clippy --- crates/cairo-lang-sierra-to-casm/src/compiler.rs | 15 +++++++-------- .../src/compiler_version.rs | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/cairo-lang-sierra-to-casm/src/compiler.rs b/crates/cairo-lang-sierra-to-casm/src/compiler.rs index 8649398f688..7e62aec6b5b 100644 --- a/crates/cairo-lang-sierra-to-casm/src/compiler.rs +++ b/crates/cairo-lang-sierra-to-casm/src/compiler.rs @@ -172,8 +172,8 @@ impl CasmCairoProgram { sierra_program: &Program, cairo_program: &CairoProgram, ) -> Result { - let replacer = CanonicalReplacer::from_program(&sierra_program); - let sierra_program = &replacer.apply(&sierra_program); + let replacer = CanonicalReplacer::from_program(sierra_program); + let sierra_program = &replacer.apply(sierra_program); let prime = Felt252::prime(); @@ -205,9 +205,8 @@ impl CasmCairoProgram { MulModType::id(), ]); - let sierra_program_registry = - ProgramRegistry::::new(&sierra_program) - .map_err(CompilationError::ProgramRegistryError)?; + let sierra_program_registry = ProgramRegistry::::new(sierra_program) + .map_err(CompilationError::ProgramRegistryError)?; let type_sizes = get_type_size_map(sierra_program, &sierra_program_registry).unwrap_or_default(); @@ -253,7 +252,7 @@ impl CasmCairoProgram { .filter(|type_id| { !builtin_types.contains(type_resolver.get_generic_id(type_id)) }) - .and_then(|type_id| { + .map(|type_id| { let debug_name = type_id.debug_name.clone().map(|name| name.to_string()); let generic_id = type_resolver.get_generic_id(type_id).clone(); let size = *type_sizes.get(type_id).unwrap(); @@ -261,7 +260,7 @@ impl CasmCairoProgram { let long_id = type_resolver.get_long_id(type_id); let panic_inner_type = if generic_id == EnumType::ID { - long_id.generic_args.get(0).and_then(|arg| match arg { + long_id.generic_args.first().and_then(|arg| match arg { GenericArg::UserType(ut) => ut .debug_name .as_ref() @@ -284,7 +283,7 @@ impl CasmCairoProgram { None }; - Some(CasmCairoOutputArg { generic_id, size, panic_inner_type, debug_name }) + CasmCairoOutputArg { generic_id, size, panic_inner_type, debug_name } }) .into_iter() .collect_vec(); diff --git a/crates/cairo-lang-sierra-to-casm/src/compiler_version.rs b/crates/cairo-lang-sierra-to-casm/src/compiler_version.rs index b5d1940030a..56494c84662 100644 --- a/crates/cairo-lang-sierra-to-casm/src/compiler_version.rs +++ b/crates/cairo-lang-sierra-to-casm/src/compiler_version.rs @@ -26,6 +26,7 @@ pub fn current_compiler_version_id() -> VersionId { } /// The version of the Sierra compiler that compiled the contract. +/// /// Major version should be updated in any non-backwards compatible change of the Sierra compiler. /// Minor version should be updated in any backwards compatible change of the Sierra compiler. /// For more information see docs/CONTRIBUTING.md.