File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed
Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 22Cargo.lock
33* .swp
44* ~
5+ * .iml
Original file line number Diff line number Diff line change 11use std:: collections:: HashMap ;
2- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
2+ use std:: sync:: atomic:: { AtomicUsize , Ordering , ATOMIC_USIZE_INIT } ;
33
44#[ derive( Debug ) ]
55#[ derive( Clone ) ]
@@ -52,7 +52,7 @@ pub struct ObjectRef {
5252 id : usize ,
5353}
5454
55- static current_ref_id : AtomicUsize = :: std :: sync :: atomic :: ATOMIC_USIZE_INIT ;
55+ static CURRENT_REF_ID : AtomicUsize = ATOMIC_USIZE_INIT ;
5656
5757#[ derive( Debug ) ]
5858pub struct ObjectStore {
@@ -65,7 +65,7 @@ impl ObjectStore {
6565 }
6666
6767 pub fn allocate ( & mut self , obj : ObjectContent ) -> ObjectRef {
68- let obj_ref = ObjectRef { id : current_ref_id . fetch_add ( 1 , Ordering :: SeqCst ) } ;
68+ let obj_ref = ObjectRef { id : CURRENT_REF_ID . fetch_add ( 1 , Ordering :: SeqCst ) } ;
6969 self . all_objects . insert ( obj_ref. clone ( ) , Object { content : obj } ) ;
7070 obj_ref
7171 }
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ impl<EP: EnvProxy> Processor<EP> {
8686 let instructions: Vec < Instruction > = instructions:: InstructionDecoder :: new ( bytecode. iter ( ) ) . into_iter ( ) . collect ( ) ;
8787 let mut program_counter = 0 as usize ;
8888 let mut stack = VectorStack :: new ( ) ;
89- while true {
89+ loop {
9090 let instruction = try!( instructions. get ( program_counter) . ok_or ( ProcessorError :: InvalidProgramCounter ) ) ;
9191 program_counter += 1 ;
9292 match * instruction {
Original file line number Diff line number Diff line change @@ -10,12 +10,11 @@ pub trait EnvProxy {
1010
1111
1212/// An EnvProxy that exposes the real environment
13- pub struct RealEnvProxy {
14- }
13+ pub struct RealEnvProxy ;
1514
1615impl RealEnvProxy {
1716 pub fn new ( ) -> RealEnvProxy {
18- RealEnvProxy { }
17+ RealEnvProxy
1918 }
2019}
2120
You can’t perform that action at this time.
0 commit comments