Skip to content

Commit 3074bc6

Browse files
committed
style: use only the filename for map keys
1 parent e509eda commit 3074bc6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

agent-control/src/config_migrate/migration/converter.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ fn retrieve_dir_mapping_values<F: FileReader>(
118118
.filter(|p| dir_info.valid_filename(p));
119119

120120
let mut read_files = valid_extension_files.map(|filepath| {
121-
file_reader
122-
.read(&filepath)
123-
.map(|content| (filepath, content))
121+
file_reader.read(&filepath).map(|content| {
122+
// If I am here means read was successful (it was a file), so I can unwrap `file_name`.
123+
let filename = filepath.file_name().unwrap().to_string_lossy().to_string();
124+
(filename, content)
125+
})
124126
});
125127

126128
let read_files = read_files.try_fold(HashMap::new(), |mut acc, read_file| {

0 commit comments

Comments
 (0)