@@ -643,7 +643,7 @@ impl InspectorStackRefMut<'_> {
643
643
self . inner_context_data = Some ( InnerContextData { original_origin : cached_env. tx . caller } ) ;
644
644
self . in_inner_context = true ;
645
645
646
- let res = self . with_stack ( |inspector| {
646
+ let res = self . with_inspector ( |inspector| {
647
647
let ( db, journal, env) = ecx. as_db_env_and_journal ( ) ;
648
648
let mut evm = new_evm_with_inspector ( db, env. to_owned ( ) , inspector) ;
649
649
@@ -740,23 +740,22 @@ impl InspectorStackRefMut<'_> {
740
740
( InterpreterResult { result, output, gas } , address)
741
741
}
742
742
743
- /// Moves out of references, constructs an [`InspectorStack`] and runs the given closure with
744
- /// it.
745
- fn with_stack < O > ( & mut self , f : impl FnOnce ( & mut InspectorStack ) -> O ) -> O {
746
- let mut stack = InspectorStack {
747
- cheatcodes : self . cheatcodes . as_deref_mut ( ) . map ( |cheats| {
748
- core:: mem:: replace ( cheats, Cheatcodes :: new ( cheats. config . clone ( ) ) ) . into ( )
749
- } ) ,
750
- inner : std:: mem:: take ( self . inner ) ,
751
- } ;
743
+ /// Moves out of references, constructs a new [`InspectorStackRefMut`] and runs the given
744
+ /// closure with it.
745
+ fn with_inspector < O > ( & mut self , f : impl FnOnce ( InspectorStackRefMut < ' _ > ) -> O ) -> O {
746
+ let mut cheatcodes = self
747
+ . cheatcodes
748
+ . as_deref_mut ( )
749
+ . map ( |cheats| core:: mem:: replace ( cheats, Cheatcodes :: new ( cheats. config . clone ( ) ) ) ) ;
750
+ let mut inner = std:: mem:: take ( self . inner ) ;
752
751
753
- let out = f ( & mut stack ) ;
752
+ let out = f ( InspectorStackRefMut { cheatcodes : cheatcodes . as_mut ( ) , inner : & mut inner } ) ;
754
753
755
754
if let Some ( cheats) = self . cheatcodes . as_deref_mut ( ) {
756
- * cheats = * stack . cheatcodes . take ( ) . unwrap ( ) ;
755
+ * cheats = cheatcodes. unwrap ( ) ;
757
756
}
758
757
759
- * self . inner = stack . inner ;
758
+ * self . inner = inner;
760
759
761
760
out
762
761
}
0 commit comments