refactor load_paths

This commit is contained in:
Ivan Tham 2020-07-16 21:15:24 +08:00 committed by GitHub
parent 938ba492c4
commit 55c2aa2749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,11 +178,9 @@ fn main() -> std::io::Result<()> {
)
.get_matches();
let load_paths = if let Some(load_paths) = matches.values_of("LOAD_PATH") {
load_paths.map(|p| Path::new(p)).collect()
} else {
Vec::new()
};
let load_paths = matches
.values_of("LOAD_PATH")
.map_or_else(Vec::new, |vals| vals.map(Path::new).collect());
let options = &Options::default()
.load_paths(&load_paths)