From 4443c4b7ccc0f53b94bf2d47c1907047ba42d0bf Mon Sep 17 00:00:00 2001 From: Jan Likar Date: Fri, 13 Nov 2015 02:08:57 +0100 Subject: [PATCH] Correct some non-idiomatic code --- src/bin/rustfmt.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index d9f4d46ec30..b90cdb3d3ca 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -29,7 +29,7 @@ use getopts::Options; /// Rustfmt operations. enum Operation { - /// Format files and its child modules. + /// Format files and their child modules. Format(Vec, WriteMode), /// Print the help message. Help, @@ -193,11 +193,7 @@ fn determine_operation(opts: &Options, args: I) -> Operation None => WriteMode::Replace, }; - let mut files = Vec::with_capacity(matches.free.len()); - - for arg in matches.free { - files.push(PathBuf::from(arg)); - } + let files: Vec<_> = matches.free.iter().map(|a| PathBuf::from(a)).collect(); Operation::Format(files, write_mode) }