fix introduced clippy warning

This commit is contained in:
Patrick Ventuzelo
2019-12-13 10:55:21 +01:00
parent a8cef86826
commit e9c2905795
2 changed files with 9 additions and 11 deletions

View File

@@ -346,11 +346,7 @@ impl Registers {
let c = &mut scratch_counts.1[gpr as usize]; let c = &mut scratch_counts.1[gpr as usize];
*c = match c.checked_sub(1) { *c = match c.checked_sub(1) {
Some(e) => e, Some(e) => e,
None => { None => return Err(Error::Microwasm(format!("Double-freed register: {}", gpr))),
return Err(Error::Microwasm(
format!("Double-freed register: {}", gpr).to_string(),
))
}
}; };
if *c == 0 { if *c == 0 {
scratch_counts.0.release(gpr); scratch_counts.0.release(gpr);
@@ -2094,7 +2090,7 @@ macro_rules! store {
} }
if !(offset <= i32::max_value() as u32) { if !(offset <= i32::max_value() as u32) {
return Err(Error::Microwasm(format!("store: offset value too big {}", offset).to_string())) return Err(Error::Microwasm(format!("store: offset value too big {}", offset)))
} }
let mut src = self.pop()?; let mut src = self.pop()?;

View File

@@ -396,13 +396,14 @@ where
(&mut else_block.calling_convention, &else_.to_drop), (&mut else_block.calling_convention, &else_.to_drop),
) { ) {
((Some(Left(ref cc)), _), ref mut other @ (None, _)) ((Some(Left(ref cc)), _), ref mut other @ (None, _))
| (ref mut other @ (None, _), (Some(Left(ref cc)), _)) => Ok({ | (ref mut other @ (None, _), (Some(Left(ref cc)), _)) => {
let mut cc = ctx.serialize_block_args(cc, max_params)?; let mut cc = ctx.serialize_block_args(cc, max_params)?;
if let Some(to_drop) = other.1 { if let Some(to_drop) = other.1 {
drop_elements(&mut cc.arguments, to_drop.clone()); drop_elements(&mut cc.arguments, to_drop.clone());
} }
*other.0 = Some(Left(cc)); *other.0 = Some(Left(cc));
}), Ok(())
},
( (
(ref mut then_cc @ None, then_to_drop), (ref mut then_cc @ None, then_to_drop),
(ref mut else_cc @ None, else_to_drop), (ref mut else_cc @ None, else_to_drop),
@@ -464,9 +465,10 @@ where
ctx.br(else_); ctx.br(else_);
} }
other => { other => {
return Err(Error::Microwasm( return Err(Error::Microwasm(format!(
format!("br_if unimplemented case: {:#?}", other).to_string(), "br_if unimplemented case: {:#?}",
)) other
)))
} }
}; };
} }