diff options
author | 2018-07-07 19:58:31 -0500 | |
---|---|---|
committer | 2018-07-07 19:58:31 -0500 | |
commit | 118167d8a30c122060dbc53d07ae10253aebfe18 (patch) | |
tree | 946bba6fa8143e60a53db23c31cd6eb8ebb340c8 | |
parent | remove more Cargo usage from main binary (diff) | |
download | cargo-ebuild-118167d8a30c122060dbc53d07ae10253aebfe18.tar.gz cargo-ebuild-118167d8a30c122060dbc53d07ae10253aebfe18.tar.bz2 cargo-ebuild-118167d8a30c122060dbc53d07ae10253aebfe18.zip |
replace outdated try!() macro with ? operator
-rw-r--r-- | src/lib.rs | 36 |
1 files changed, 16 insertions, 20 deletions
@@ -121,28 +121,24 @@ pub fn run(verbose: u32, quiet: bool) -> CliResult { let ebuild_path = PathBuf::from(format!("{}-{}.ebuild", package.name(), package.version())); // Open the file where we'll write the ebuild - let mut file = try!( - OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&ebuild_path) - .chain_err(|| "failed to create ebuild") - ); + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&ebuild_path) + .chain_err(|| "failed to create ebuild")?; // write the contents out - try!( - write!( - file, - include_str!("ebuild.template"), - description = desc.trim(), - homepage = homepage.trim(), - license = license.trim(), - crates = crates.join(""), - cargo_ebuild_ver = env!("CARGO_PKG_VERSION"), - this_year = 1900 + time::now().tm_year, - ).chain_err(|| "unable to write ebuild to disk") - ); + write!( + file, + include_str!("ebuild.template"), + description = desc.trim(), + homepage = homepage.trim(), + license = license.trim(), + crates = crates.join(""), + cargo_ebuild_ver = env!("CARGO_PKG_VERSION"), + this_year = 1900 + time::now().tm_year, + ).chain_err(|| "unable to write ebuild to disk")?; println!("Wrote: {}", ebuild_path.display()); |