diff --git a/src/main.rs b/src/main.rs index 6c7545f..18ac3a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ pub fn main() -> ExitCode { Err(e) => match e.downcast::() { Ok(SilentExit { code }) => code.into(), Err(e) => { - let _ = writeln!(io::stderr(), "zoxide: {e:?}"); + _ = writeln!(io::stderr(), "zoxide: {e:?}"); ExitCode::FAILURE } }, diff --git a/src/util.rs b/src/util.rs index f980f33..e549021 100644 --- a/src/util.rs +++ b/src/util.rs @@ -158,7 +158,7 @@ pub fn write(path: impl AsRef, contents: impl AsRef<[u8]>) -> Result<()> { let (mut tmp_file, tmp_path) = tmpfile(dir)?; let result = (|| { // Write to the tmpfile. - let _ = tmp_file.set_len(contents.len() as u64); + _ = tmp_file.set_len(contents.len() as u64); tmp_file .write_all(contents) .with_context(|| format!("could not write to file: {}", tmp_path.display()))?; @@ -173,7 +173,7 @@ pub fn write(path: impl AsRef, contents: impl AsRef<[u8]>) -> Result<()> { let uid = Uid::from_raw(metadata.uid()); let gid = Gid::from_raw(metadata.gid()); - let _ = unistd::fchown(tmp_file.as_raw_fd(), Some(uid), Some(gid)); + _ = unistd::fchown(tmp_file.as_raw_fd(), Some(uid), Some(gid)); } // Close and rename the tmpfile. @@ -182,7 +182,7 @@ pub fn write(path: impl AsRef, contents: impl AsRef<[u8]>) -> Result<()> { })(); // In case of an error, delete the tmpfile. if result.is_err() { - let _ = fs::remove_file(&tmp_path); + _ = fs::remove_file(&tmp_path); } result } @@ -373,5 +373,9 @@ pub fn resolve_path(path: impl AsRef) -> Result { /// Convert a string to lowercase, with a fast path for ASCII strings. pub fn to_lowercase(s: impl AsRef) -> String { let s = s.as_ref(); - if s.is_ascii() { s.to_ascii_lowercase() } else { s.to_lowercase() } + if s.is_ascii() { + s.to_ascii_lowercase() + } else { + s.to_lowercase() + } }