simplify somewhat how load paths are calculated from the cli

This commit is contained in:
Connor Skees 2020-07-16 00:22:50 -04:00
parent 179b368ef8
commit 938ba492c4

View File

@ -178,15 +178,14 @@ fn main() -> std::io::Result<()> {
) )
.get_matches(); .get_matches();
let vals: Vec<&Path>; let load_paths = if let Some(load_paths) = matches.values_of("LOAD_PATH") {
if let Some(load_paths) = matches.values_of("LOAD_PATH") { load_paths.map(|p| Path::new(p)).collect()
vals = load_paths.map(|p| Path::new(p)).collect();
} else { } else {
vals = Vec::new(); Vec::new()
} };
let options = &Options::default() let options = &Options::default()
.load_paths(&vals) .load_paths(&load_paths)
.quiet(matches.is_present("QUIET")) .quiet(matches.is_present("QUIET"))
.unicode_error_messages(!matches.is_present("NO_UNICODE")) .unicode_error_messages(!matches.is_present("NO_UNICODE"))
.allows_charset(!matches.is_present("NO_CHARSET")); .allows_charset(!matches.is_present("NO_CHARSET"));