Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Feb 2, 2024
1 parent ebd27e4 commit 638b6c4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Path {
None | Some((_, "\x00")) => None,
Some((_, path)) => {
debug_assert!(path.ends_with('\x00'));
Some(unsafe { &Path::from_bytes_with_nul_unchecked(path.as_bytes()) })
Some(unsafe { Path::from_bytes_with_nul_unchecked(path.as_bytes()) })
}
}
}
Expand Down Expand Up @@ -257,9 +257,7 @@ impl Path {
pub fn parent(&self) -> Option<PathBuf> {
let rk_path_bytes = self.as_ref()[..].as_bytes();
match rk_path_bytes.iter().rposition(|x| *x == b'/') {
Some(0) if rk_path_bytes.len() != 1 => {
return Some(PathBuf::from("/"));
}
Some(0) if rk_path_bytes.len() != 1 => Some(PathBuf::from("/")),
Some(slash_index) => {
// if we have a directory that ends with `/`,
// still need to "go up" one parent
Expand Down

0 comments on commit 638b6c4

Please sign in to comment.