Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalatrax committed Oct 25, 2024
1 parent d57210f commit ff19826
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/cairo-lang-sierra-to-casm/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ impl CasmCairoProgram {
sierra_program: &Program,
cairo_program: &CairoProgram,
) -> Result<Self, CompilationError> {
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();

Expand Down Expand Up @@ -205,9 +205,8 @@ impl CasmCairoProgram {
MulModType::id(),
]);

let sierra_program_registry =
ProgramRegistry::<CoreType, CoreLibfunc>::new(&sierra_program)
.map_err(CompilationError::ProgramRegistryError)?;
let sierra_program_registry = ProgramRegistry::<CoreType, CoreLibfunc>::new(sierra_program)
.map_err(CompilationError::ProgramRegistryError)?;

let type_sizes =
get_type_size_map(sierra_program, &sierra_program_registry).unwrap_or_default();
Expand Down Expand Up @@ -253,15 +252,15 @@ 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();

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()
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions crates/cairo-lang-sierra-to-casm/src/compiler_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ff19826

Please sign in to comment.