Move current_directory variable definition closer to usage

This commit is contained in:
Sijmen 2022-08-01 03:21:50 +02:00 committed by David Peter
parent a5f69579cf
commit cb6295d025

View file

@ -123,8 +123,6 @@ fn extract_search_pattern(matches: &clap::ArgMatches) -> Result<&'_ str> {
}
fn extract_search_paths(matches: &clap::ArgMatches) -> Result<Vec<PathBuf>> {
let current_directory = Path::new(".");
let parameter_paths = matches
.values_of_os("path")
.or_else(|| matches.values_of_os("search-path"));
@ -145,6 +143,7 @@ fn extract_search_paths(matches: &clap::ArgMatches) -> Result<Vec<PathBuf>> {
})
.collect(),
None => {
let current_directory = Path::new(".");
ensure_current_directory_exists(current_directory)?;
vec![current_directory.to_path_buf()]
}