Skip to content

Commit 02bdfa5

Browse files
Minor improvements
1 parent f721e83 commit 02bdfa5

File tree

6 files changed

+9
-14
lines changed

6 files changed

+9
-14
lines changed

hint_accountant/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![forbid(unsafe_code)]
33
use std::fs::{self, File};
44
use std::io::BufReader;
5-
use std::rc::Rc;
65

76
use cairo_vm::stdlib::collections::{HashMap, HashSet};
87
use cairo_vm::{
@@ -69,7 +68,7 @@ fn run() {
6968
&ap_tracking_data,
7069
&reference_ids,
7170
&references,
72-
Rc::default(),
71+
Default::default(),
7372
)
7473
.expect("this implementation is infallible");
7574
matches!(

vm/src/hint_processor/builtin_hint_processor/builtin_hint_processor_definition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,14 +1450,14 @@ mod tests {
14501450
let hint_data =
14511451
HintProcessorData::new_default(String::from("enter_scope_custom_a"), HashMap::new());
14521452
assert_matches!(
1453-
hint_processor.execute_hint(&mut vm, exec_scopes, &any_box!(hint_data),),
1453+
hint_processor.execute_hint(&mut vm, exec_scopes, &any_box!(hint_data)),
14541454
Ok(())
14551455
);
14561456
assert_eq!(exec_scopes.data.len(), 2);
14571457
let hint_data =
14581458
HintProcessorData::new_default(String::from("enter_scope_custom_a"), HashMap::new());
14591459
assert_matches!(
1460-
hint_processor.execute_hint(&mut vm, exec_scopes, &any_box!(hint_data),),
1460+
hint_processor.execute_hint(&mut vm, exec_scopes, &any_box!(hint_data)),
14611461
Ok(())
14621462
);
14631463
assert_eq!(exec_scopes.data.len(), 3);

vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use super::hint_processor_utils::*;
99
use crate::any_box;
1010
use crate::hint_processor::cairo_1_hint_processor::dict_manager::DictSquashExecScope;
1111
use crate::hint_processor::hint_processor_definition::HintReference;
12+
use crate::stdlib::rc::Rc;
1213
use crate::stdlib::{boxed::Box, collections::HashMap, prelude::*};
1314
use crate::types::relocatable::{MaybeRelocatable, Relocatable};
1415
use crate::vm::runners::cairo_runner::ResourceTracker;
@@ -30,7 +31,6 @@ use cairo_lang_casm::{
3031
};
3132
use core::any::Any;
3233
use core::ops::Shl;
33-
use std::rc::Rc;
3434

3535
use num_bigint::{BigInt, BigUint};
3636
use num_integer::{ExtendedGcd, Integer};

vm/src/hint_processor/hint_processor_definition.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use std::rc::Rc;
2-
3-
use crate::stdlib::{any::Any, boxed::Box, collections::HashMap, prelude::*};
1+
use crate::stdlib::{any::Any, boxed::Box, collections::HashMap, prelude::*, rc::Rc};
42

53
use crate::any_box;
64
use crate::serde::deserialize_program::ApTracking;
@@ -50,7 +48,7 @@ pub trait HintProcessorLogic {
5048
code: hint_code.to_string(),
5149
ap_tracking: ap_tracking_data.clone(),
5250
ids_data: get_ids_data(reference_ids, references)?,
53-
constants: constants.clone(),
51+
constants,
5452
}))
5553
}
5654

vm/src/tests/run_deprecated_contract_class_simplified.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![cfg(feature = "extensive_hints")]
2-
use std::rc::Rc;
32

43
/* This file contains a test that runs the program: cairo_programs/starknet_os_deprecated_cc.cairo
54
For testsing purposes, the contract ran by this program is hardcoded, with values taken from compiling:
@@ -16,7 +15,7 @@ use std::rc::Rc;
1615
The purpose of this test is to check the functionality of the HintProcessor::execute_hint_extensive functionality
1716
And to show a very simplified example on how it can be used to achieve the `vm_load_data` functionality used by starknet os programs
1817
*/
19-
use crate::stdlib::{collections::HashMap, prelude::*};
18+
use crate::stdlib::{collections::HashMap, prelude::*, rc::Rc};
2019

2120
use crate::Felt252;
2221
use num_traits::Zero;
@@ -298,7 +297,7 @@ pub fn vm_load_program(
298297
&hint_ap_tracking_data,
299298
&reference_ids,
300299
&references,
301-
Rc::default(),
300+
Default::default(),
302301
)?;
303302
// Create the hint extension
304303
// As the hint from the compiled constract has offset 0, the hint pc will be equal to the loaded contract's program base:

vm/src/vm/runners/cairo_runner.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::rc::Rc;
2-
31
use crate::{
42
air_private_input::AirPrivateInput,
53
air_public_input::{PublicInput, PublicInputError},
@@ -9,6 +7,7 @@ use crate::{
97
collections::{BTreeMap, HashMap, HashSet},
108
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
119
prelude::*,
10+
rc::Rc,
1211
},
1312
types::{builtin_name::BuiltinName, layout::CairoLayoutParams, layout_name::LayoutName},
1413
vm::{

0 commit comments

Comments
 (0)