Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb6295d

Browse files
vijfhoeksharkdp
authored andcommitted
Move current_directory variable definition closer to usage
1 parent a5f6957 commit cb6295d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ fn extract_search_pattern(matches: &clap::ArgMatches) -> Result<&'_ str> {
123123
}
124124

125125
fn extract_search_paths(matches: &clap::ArgMatches) -> Result<Vec<PathBuf>> {
126-
let current_directory = Path::new(".");
127-
128126
let parameter_paths = matches
129127
.values_of_os("path")
130128
.or_else(|| matches.values_of_os("search-path"));
@@ -145,6 +143,7 @@ fn extract_search_paths(matches: &clap::ArgMatches) -> Result<Vec<PathBuf>> {
145143
})
146144
.collect(),
147145
None => {
146+
let current_directory = Path::new(".");
148147
ensure_current_directory_exists(current_directory)?;
149148
vec![current_directory.to_path_buf()]
150149
}

0 commit comments

Comments
 (0)