Skip to content

Commit

Permalink
review: Remove extraenous .unwrap call
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed Dec 30, 2024
1 parent eea18ba commit b7dbb48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ struct PathWrapper {
}

impl PathWrapper {
fn from_dir_entry(path: PathBuf, file_name: OsString, e: DirEntry) -> Self {
fn from_dir_entry(path: PathBuf, file_name: Option<OsString>, e: DirEntry) -> Self {
let is_directory = e
.file_type()
.ok()
Expand All @@ -352,7 +352,7 @@ impl PathWrapper {
Self {
path,
is_directory,
file_name: Some(file_name),
file_name,
}
}
fn from_path(path: PathBuf) -> Self {
Expand Down Expand Up @@ -944,10 +944,10 @@ fn fill_todo(
let (path, file_name) = if curdir {
let path = e.path();
let file_name = path.file_name().unwrap();
(PathBuf::from(file_name), file_name.to_owned())
(PathBuf::from(file_name), Some(file_name.to_owned()))
} else {
let path = e.path();
let file_name = path.file_name().unwrap().to_owned();
let file_name = path.file_name().map(ToOwned::to_owned);
(path, file_name)
};
PathWrapper::from_dir_entry(path, file_name, e)
Expand Down

0 comments on commit b7dbb48

Please sign in to comment.