Reduce clone()-ing of commands to necessary places

This commit is contained in:
Mario Krehl 2016-09-07 12:57:34 +02:00
parent e2d3e5597b
commit 6fe4408800

View file

@ -153,7 +153,7 @@ fn main() {
if matches.is_present("versions") { if matches.is_present("versions") {
debug!("Showing versions"); debug!("Showing versions");
let mut result = vec![]; let mut result = vec![];
for command in get_commands().iter() { for command in commands.iter() {
result.push(crossbeam::scope(|scope| { result.push(crossbeam::scope(|scope| {
scope.spawn(|| { scope.spawn(|| {
let v = Command::new(format!("imag-{}",command)).arg("--version").output(); let v = Command::new(format!("imag-{}",command)).arg("--version").output();
@ -186,7 +186,7 @@ fn main() {
}; };
// Typos happen, so check if the given subcommand is one found in $PATH // Typos happen, so check if the given subcommand is one found in $PATH
if !commands.clone().contains(&String::from(subcommand)) { if !commands.contains(&String::from(subcommand)) {
println!("No such command: 'imag-{}'", subcommand); println!("No such command: 'imag-{}'", subcommand);
println!("See 'imag --help' for available subcommands"); println!("See 'imag --help' for available subcommands");
exit(2); exit(2);