From 938ba492c47925a5bc8f577e298d6ec4334f9873 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Thu, 16 Jul 2020 00:22:50 -0400 Subject: [PATCH] simplify somewhat how load paths are calculated from the cli --- src/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6c15481..de9f3ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,15 +178,14 @@ fn main() -> std::io::Result<()> { ) .get_matches(); - let vals: Vec<&Path>; - if let Some(load_paths) = matches.values_of("LOAD_PATH") { - vals = load_paths.map(|p| Path::new(p)).collect(); + let load_paths = if let Some(load_paths) = matches.values_of("LOAD_PATH") { + load_paths.map(|p| Path::new(p)).collect() } else { - vals = Vec::new(); - } + Vec::new() + }; let options = &Options::default() - .load_paths(&vals) + .load_paths(&load_paths) .quiet(matches.is_present("QUIET")) .unicode_error_messages(!matches.is_present("NO_UNICODE")) .allows_charset(!matches.is_present("NO_CHARSET"));