Skip to content

Commit

Permalink
Add a local macro replacing deprecated std::try!
Browse files Browse the repository at this point in the history
This is easier than adding `#[allow(deprecated)]` everywhere, and better
than adding a global `#![allow(deprecated)]` that might hide other
interesting deprecations.
  • Loading branch information
cuviper committed Oct 20, 2019
1 parent 9c3a43a commit dee7612
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
#![allow(bare_trait_objects)]
#![allow(ellipsis_inclusive_range_patterns)]

/// Local macro to avoid `std::try!`, deprecated in Rust 1.39.
macro_rules! try {
($result:expr) => {
match $result {
Ok(value) => value,
Err(error) => return Err(error),
}
};
}

use std::env;
use std::ffi::OsString;
use std::fs;
Expand Down

0 comments on commit dee7612

Please sign in to comment.