Fix recent clippy lints

This commit is contained in:
2019-11-13 19:55:33 +01:00
parent 2e58861285
commit d7f3ded7e0
4 changed files with 7 additions and 8 deletions

View File

@@ -22,7 +22,6 @@ fn main() {
machine.get_program_counter(),
machine.frame.len() - 1,
str);
return;
}
}
}

View File

@@ -30,8 +30,8 @@ pub struct Machine {
#[cfg(feature = "bonus:heap")]
pub heap: Heaps,
pub stream_in: Box<Read + Send + Sync>,
pub stream_out: Arc<Mutex<Write + Send + Sync>>,
pub stream_in: Box<dyn Read + Send + Sync>,
pub stream_out: Arc<Mutex<dyn Write + Send + Sync>>,
}
impl Machine {
@@ -170,7 +170,7 @@ impl Machine {
}
self.block.seek(checkpoint).unwrap();
Ok((name.to_string(), params))
Ok(((*name).to_string(), params))
}
// pub fn get_stack_pointer(&self) -> usize {
@@ -185,11 +185,11 @@ impl Machine {
Ok(self.block.read_u8()? as usize)
}
pub fn set_input(&mut self, instream: Box<Read + Send + Sync>) {
pub fn set_input(&mut self, instream: Box<dyn Read + Send + Sync>) {
self.stream_in = instream;
}
pub fn set_output(&mut self, outstream: Arc<Mutex<Write + Send + Sync>>) {
pub fn set_output(&mut self, outstream: Arc<Mutex<dyn Write + Send + Sync>>) {
self.stream_out = outstream;
}
}

View File

@@ -35,7 +35,7 @@ impl NetStack {
let h1 = ((host >> 24) & 0xFF) as u8;
let h2 = ((host >> 16) & 0xFF) as u8;
let h3 = ((host >> 8) & 0xFF) as u8;
let h4 = ((host >> 0) & 0xFF) as u8;
let h4 = (host & 0xFF) as u8;
let addr: String = format!("{}.{}.{}.{}:{}", h1, h2, h3, h4, port);
if let Ok(stream) = TcpStream::connect(addr) {

View File

@@ -380,7 +380,7 @@ fn iastore(machine: &mut Machine) -> Result<()> {
_ => return Err("Cannot use int as heapref"),
};
let index: i32 = machine.cur_stack().pop()?.try_into()?;
let value = machine.cur_stack().pop()?.clone();
let value = machine.cur_stack().pop()?;
RefCell::borrow_mut(&heap)[index as usize] = value;