From 8a1fa499bb07c9b408f6a3bbdecc46cea3937b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 2 Feb 2024 11:36:28 +0100 Subject: [PATCH] Fix clippy warnings --- src/path.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/path.rs b/src/path.rs index 438470ea3..06082e1b2 100644 --- a/src/path.rs +++ b/src/path.rs @@ -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()) }) } } } @@ -257,9 +257,7 @@ impl Path { pub fn parent(&self) -> Option { 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