Skip to content

Commit

Permalink
Format with rustfmt 1.4.22-nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 28, 2020
1 parent eaf72a1 commit de066c4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion runtime/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ impl<'a> Interpreter<'a> {
None => {
return Err(Trap {
origin: TrapOrigin::CallIndirectElemUnitialized,
})
});
}
};

Expand Down
56 changes: 28 additions & 28 deletions runtime/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,37 +299,37 @@ pub trait FloatOp {
}

macro_rules! impl_convert_float_s {
($T:ty, $U:ty, $N:ident) => (
#[inline]
fn $N(self) -> Option<$U> {
if self.is_nan() {
None
} else {
if self >= -(<$U>::min_value() as $T) || self < <$U>::min_value() as $T {
None
} else {
Some(self.trunc() as $U)
}
}
}
)
($T:ty, $U:ty, $N:ident) => {
#[inline]
fn $N(self) -> Option<$U> {
if self.is_nan() {
None
} else {
if self >= -(<$U>::min_value() as $T) || self < <$U>::min_value() as $T {
None
} else {
Some(self.trunc() as $U)
}
}
}
};
}

macro_rules! impl_convert_float_u {
($T:ty, $U:ty, $S:ty, $N:ident) => (
#[inline]
fn $N(self) -> Option<$U> {
if self.is_nan() {
None
} else {
if self >= -(<$S>::min_value() as $T) * 2.0 || self <= -1.0 {
None
} else {
Some(self.trunc() as $U)
}
}
}
)
($T:ty, $U:ty, $S:ty, $N:ident) => {
#[inline]
fn $N(self) -> Option<$U> {
if self.is_nan() {
None
} else {
if self >= -(<$S>::min_value() as $T) * 2.0 || self <= -1.0 {
None
} else {
Some(self.trunc() as $U)
}
}
}
};
}

macro_rules! impl_float_op {
Expand Down
2 changes: 1 addition & 1 deletion runtime/tests/script/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> Iterator for Lexer<'a> {
match self.chars.next() {
Some((_, c)) if c.is_whitespace() => {}
Some((start, '(')) | Some((start, ')')) => {
return Some(&self.src[start..start + 1])
return Some(&self.src[start..start + 1]);
}
Some((start, '"')) => {
// string
Expand Down
10 changes: 5 additions & 5 deletions runtime/tests/script/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn run_assertion(store: &mut Store, registry: &Registry, assertion: Assertion) {
}
Exhaustion(action, reason) => {
match (reason.as_ref(), run_action(store, registry, &action)) {
("call stack exhausted", Err(Error::StackOverflow)) => (),
("call stack exhausted", Err(Error::StackOverflow)) => {}
(reason, err) => panic!(
"the action `{:?}` should cause a stack overflow (reason = {}, err = {:?})",
action, reason, err
Expand All @@ -160,7 +160,7 @@ fn run_assertion(store: &mut Store, registry: &Registry, assertion: Assertion) {
let (_, m) = decode_module_src(&module);
// Do not resolve the imports for invalid modules
match (reason, instantiate_module(store, m, &[]).err()) {
(_, Some(Error::InvalidModule)) => (),
(_, Some(Error::InvalidModule)) => {}
(reason, err) => panic!(
"instantiating module `{:?}` should not be valid (reason = {}, err = {:?})",
module, reason, err
Expand Down Expand Up @@ -193,9 +193,9 @@ fn run_assertion(store: &mut Store, registry: &Registry, assertion: Assertion) {
reason.as_ref(),
instantiate_module(store, m, &imports[..]).err(),
) {
("incompatible import type", Some(Error::ImportTypeMismatch)) => (),
("elements segment does not fit", Some(Error::ElemOffsetTooLarge(_))) => (),
("data segment does not fit", Some(Error::DataOffsetTooLarge(_))) => (),
("incompatible import type", Some(Error::ImportTypeMismatch)) => {}
("elements segment does not fit", Some(Error::ElemOffsetTooLarge(_))) => {}
("data segment does not fit", Some(Error::DataOffsetTooLarge(_))) => {}
(reason, err) => panic!(
"instantiating module `{:?}` should not link (reason = {}, err = {:?})",
module, reason, err
Expand Down

0 comments on commit de066c4

Please sign in to comment.