Skip to content

Commit 944cf10

Browse files
authored
Merge pull request #44 from TimDiekmann/edition_2018
Use edition = "2018"
2 parents 176beb5 + f0d788d commit 944cf10

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description = """
55
"""
66
license = "MIT/Apache-2.0"
77
version = "1.2.3"
8+
edition = "2018"
89
keywords = ["macro", "error", "type", "enum"]
910
authors = ["Paul Colomiets <[email protected]>", "Colin Kiegel <[email protected]>"]
1011
homepage = "http://github.com/tailhook/quick-error"

examples/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ quick_error! {
2828
}
2929

3030
fn parse_file() -> Result<u64, Error> {
31-
let fname = try!(env::args().skip(1).next().ok_or(Error::NoFileName));
31+
let fname = env::args().skip(1).next().ok_or(Error::NoFileName)?;
3232
let fname = Path::new(&fname);
33-
let mut file = try!(File::open(fname).context(fname));
33+
let mut file = File::open(fname).context(fname)?;
3434
let mut buf = String::new();
35-
try!(file.read_to_string(&mut buf).context(fname));
36-
Ok(try!(buf.parse().context(fname)))
35+
file.read_to_string(&mut buf).context(fname)?;
36+
Ok(buf.parse().context(fname)?)
3737
}
3838

3939
fn main() {

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@
220220
//! }
221221
//!
222222
//! fn openfile(path: &Path) -> Result<(), Error> {
223-
//! try!(File::open(path).context(path));
223+
//! File::open(path).context(path)?;
224224
//!
225225
//! // If we didn't have context, the line above would be written as;
226226
//! //
227-
//! // try!(File::open(path)
228-
//! // .map_err(|err| Error::File(path.to_path_buf(), err)));
227+
//! // File::open(path)
228+
//! // .map_err(|err| Error::File(path.to_path_buf(), err))?;
229229
//!
230230
//! Ok(())
231231
//! }
@@ -1206,7 +1206,7 @@ mod test {
12061206
#[test]
12071207
fn parse_float_error() {
12081208
fn parse_float(s: &str) -> Result<f32, ContextErr> {
1209-
Ok(try!(s.parse().context(s)))
1209+
Ok(s.parse().context(s)?)
12101210
}
12111211
assert_eq!(format!("{}", parse_float("12ab").unwrap_err()),
12121212
r#"Float error "12ab": invalid float literal"#);
@@ -1215,7 +1215,7 @@ mod test {
12151215
#[test]
12161216
fn parse_int_error() {
12171217
fn parse_int(s: &str) -> Result<i32, ContextErr> {
1218-
Ok(try!(s.parse().context(s)))
1218+
Ok(s.parse().context(s)?)
12191219
}
12201220
assert_eq!(format!("{}", parse_int("12.5").unwrap_err()),
12211221
r#"Int error "12.5": invalid digit found in string"#);
@@ -1236,7 +1236,7 @@ mod test {
12361236
fn parse_utf<P: AsRef<Path>>(s: &[u8], p: P)
12371237
-> Result<(), ContextErr>
12381238
{
1239-
try!(::std::str::from_utf8(s).context(p));
1239+
::std::str::from_utf8(s).context(p)?;
12401240
Ok(())
12411241
}
12421242
let etext = parse_utf(b"a\x80\x80", "/etc").unwrap_err().to_string();

0 commit comments

Comments
 (0)