Skip to content

Commit 76cafd1

Browse files
committed
review: Remove extraenous .unwrap call
1 parent 7ad61f9 commit 76cafd1

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
@@ -335,7 +335,7 @@ struct PathWrapper {
335335
}
336336

337337
impl PathWrapper {
338-
fn from_dir_entry(path: PathBuf, file_name: OsString, e: DirEntry) -> Self {
338+
fn from_dir_entry(path: PathBuf, file_name: Option<OsString>, e: DirEntry) -> Self {
339339
let is_directory = e
340340
.file_type()
341341
.ok()
@@ -353,7 +353,7 @@ impl PathWrapper {
353353
Self {
354354
path,
355355
is_directory,
356-
file_name: Some(file_name),
356+
file_name,
357357
}
358358
}
359359
fn from_path(path: PathBuf) -> Self {
@@ -941,10 +941,10 @@ fn fill_todo(
941941
let (path, file_name) = if curdir {
942942
let path = e.path();
943943
let file_name = path.file_name().unwrap();
944-
(PathBuf::from(file_name), file_name.to_owned())
944+
(PathBuf::from(file_name), Some(file_name.to_owned()))
945945
} else {
946946
let path = e.path();
947-
let file_name = path.file_name().unwrap().to_owned();
947+
let file_name = path.file_name().map(ToOwned::to_owned);
948948
(path, file_name)
949949
};
950950
PathWrapper::from_dir_entry(path, file_name, e)

0 commit comments

Comments
 (0)