Skip to content

Commit b7dbb48

Browse files
committed
review: Remove extraenous .unwrap call
1 parent eea18ba commit b7dbb48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ struct PathWrapper {
334334
}
335335

336336
impl PathWrapper {
337-
fn from_dir_entry(path: PathBuf, file_name: OsString, e: DirEntry) -> Self {
337+
fn from_dir_entry(path: PathBuf, file_name: Option<OsString>, e: DirEntry) -> Self {
338338
let is_directory = e
339339
.file_type()
340340
.ok()
@@ -352,7 +352,7 @@ impl PathWrapper {
352352
Self {
353353
path,
354354
is_directory,
355-
file_name: Some(file_name),
355+
file_name,
356356
}
357357
}
358358
fn from_path(path: PathBuf) -> Self {
@@ -944,10 +944,10 @@ fn fill_todo(
944944
let (path, file_name) = if curdir {
945945
let path = e.path();
946946
let file_name = path.file_name().unwrap();
947-
(PathBuf::from(file_name), file_name.to_owned())
947+
(PathBuf::from(file_name), Some(file_name.to_owned()))
948948
} else {
949949
let path = e.path();
950-
let file_name = path.file_name().unwrap().to_owned();
950+
let file_name = path.file_name().map(ToOwned::to_owned);
951951
(path, file_name)
952952
};
953953
PathWrapper::from_dir_entry(path, file_name, e)

0 commit comments

Comments
 (0)