Skip to content

Commit 95ac7ea

Browse files
committed
Fix some warning on Rust 1.7
1 parent e3e67ee commit 95ac7ea

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ target
22
Cargo.lock
33
*.swp
44
*~
5+
*.iml

src/marshal/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ pub mod common;
22
pub mod decode;
33

44
use std::io;
5-
use std::collections::HashSet;
6-
use super::objects::{Code, ObjectContent, Object, ObjectRef, ObjectStore};
5+
use super::objects::{Code, ObjectContent, ObjectRef, ObjectStore};
76
use self::common::Object as MarshalObject;
87
use self::common::Code as MarshalCode;
98

src/objects/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::collections::HashMap;
2-
use std::sync::Mutex;
3-
use std::sync::atomic::{AtomicUsize, Ordering};
2+
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
43

54
#[derive(Debug)]
65
#[derive(Clone)]
@@ -51,7 +50,7 @@ pub struct ObjectRef {
5150
id: usize,
5251
}
5352

54-
static current_ref_id: AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
53+
static CURRENT_REF_ID: AtomicUsize = ATOMIC_USIZE_INIT;
5554

5655
#[derive(Debug)]
5756
pub struct ObjectStore {
@@ -64,7 +63,7 @@ impl ObjectStore {
6463
}
6564

6665
pub fn allocate(&mut self, obj: ObjectContent) -> ObjectRef {
67-
let obj_ref = ObjectRef { id: current_ref_id.fetch_add(1, Ordering::SeqCst) };
66+
let obj_ref = ObjectRef { id: CURRENT_REF_ID.fetch_add(1, Ordering::SeqCst) };
6867
self.all_objects.insert(obj_ref.clone(), Object { content: obj });
6968
obj_ref
7069
}

src/processor/instructions.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use std::str::Bytes;
2-
3-
#[derive(PartialEq)]
1+
#[derive(PartialEq)]
42
#[derive(Debug)]
53
pub enum Instruction {
64
PopTop,

src/processor/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub mod instructions;
22

3-
use super::objects::{Object, Code, ObjectStore, ObjectRef, ObjectContent};
3+
use super::objects::{Code, ObjectStore, ObjectRef, ObjectContent};
44
use super::sandbox::EnvProxy;
55
use super::stack::{Stack, VectorStack};
66
use self::instructions::Instruction;
@@ -29,7 +29,7 @@ fn run_code<EP: EnvProxy>(envproxy: &mut EP, store: &mut ObjectStore, code: Code
2929
let instructions: Vec<Instruction> = instructions::InstructionDecoder::new(bytecode.iter()).into_iter().collect();
3030
let mut program_counter = 0 as usize;
3131
let mut stack = VectorStack::new();
32-
while true {
32+
loop {
3333
let instruction = try!(instructions.get(program_counter).ok_or(ProcessorError::InvalidProgramCounter));
3434
program_counter += 1;
3535
match *instruction {

src/sandbox/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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

1615
impl RealEnvProxy {
1716
pub fn new() -> RealEnvProxy {
18-
RealEnvProxy { }
17+
RealEnvProxy
1918
}
2019
}
2120

0 commit comments

Comments
 (0)