Skip to content

Commit

Permalink
Switch to $(,)? in tri macro
Browse files Browse the repository at this point in the history
The $(...)? operation is supported since Rust 1.32.
  • Loading branch information
dtolnay committed Dec 31, 2021
1 parent 51df12e commit 31198f5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/lib.rs
Expand Up @@ -410,15 +410,12 @@ pub use crate::value::{from_value, to_value, Map, Number, Value};
// We only use our own error type; no need for From conversions provided by the
// standard library's try! macro. This reduces lines of LLVM IR by 4%.
macro_rules! tri {
($e:expr) => {
($e:expr $(,)?) => {
match $e {
crate::lib::Result::Ok(val) => val,
crate::lib::Result::Err(err) => return crate::lib::Result::Err(err),
}
};
($e:expr,) => {
tri!($e)
};
}

#[macro_use]
Expand Down

0 comments on commit 31198f5

Please sign in to comment.