From 2976b487ab373087d19a15f6e74b30d62b270ad1 Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 18 Apr 2018 01:16:32 +0100 Subject: [PATCH] Replaced try!() with ? --- src/fs/dir.rs | 4 ++-- src/options/help.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fs/dir.rs b/src/fs/dir.rs index a9c0ccc..9414c59 100644 --- a/src/fs/dir.rs +++ b/src/fs/dir.rs @@ -35,9 +35,9 @@ impl Dir { pub fn read_dir(path: PathBuf) -> IOResult { info!("Reading directory {:?}", &path); - let contents: Vec = try!(fs::read_dir(&path)? + let contents = fs::read_dir(&path)? .map(|result| result.map(|entry| entry.path())) - .collect()); + .collect::>()?; Ok(Dir { contents, path }) } diff --git a/src/options/help.rs b/src/options/help.rs index 5428c4b..388f062 100644 --- a/src/options/help.rs +++ b/src/options/help.rs @@ -96,20 +96,20 @@ impl fmt::Display for HelpString { /// Format this help options into an actual string of help /// text to be displayed to the user. fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - try!(write!(f, "Usage:\n exa [options] [files...]\n")); + write!(f, "Usage:\n exa [options] [files...]\n")?; if !self.only_long { - try!(write!(f, "{}", OPTIONS)); + write!(f, "{}", OPTIONS)?; } - try!(write!(f, "{}", LONG_OPTIONS)); + write!(f, "{}", LONG_OPTIONS)?; if self.git { - try!(write!(f, "\n{}", GIT_HELP)); + write!(f, "\n{}", GIT_HELP)?; } if self.xattrs { - try!(write!(f, "\n{}", EXTENDED_HELP)); + write!(f, "\n{}", EXTENDED_HELP)?; } Ok(())