Apply clippy fix

This commit is contained in:
topjohnwu
2025-07-02 19:36:27 -07:00
committed by John Wu
parent d660401063
commit 37a9724a54
18 changed files with 112 additions and 114 deletions

View File

@@ -583,7 +583,7 @@ impl<S: Utf8CStrBuf + Sized> FsPathBuilder for S {
}
fn append_path_fmt<T: Display>(&mut self, name: T) -> &mut Self {
self.write_fmt(format_args!("/{}", name)).ok();
self.write_fmt(format_args!("/{name}")).ok();
self
}
}
@@ -595,7 +595,7 @@ impl FsPathBuilder for dyn Utf8CStrBuf + '_ {
}
fn append_path_fmt<T: Display>(&mut self, name: T) -> &mut Self {
self.write_fmt(format_args!("/{}", name)).ok();
self.write_fmt(format_args!("/{name}")).ok();
self
}
}
@@ -846,7 +846,7 @@ fn parse_mount_info_line(line: &str) -> Option<MountInfo> {
pub fn parse_mount_info(pid: &str) -> Vec<MountInfo> {
let mut res = vec![];
let mut path = format!("/proc/{}/mountinfo", pid);
let mut path = format!("/proc/{pid}/mountinfo");
if let Ok(file) = Utf8CStr::from_string(&mut path).open(O_RDONLY | O_CLOEXEC) {
BufReader::new(file).foreach_lines(|line| {
parse_mount_info_line(line)

View File

@@ -99,7 +99,7 @@ impl<T> EarlyExitExt<T> for Result<T, EarlyExit> {
exit(0)
}
Err(_) => {
eprintln!("{}", output);
eprintln!("{output}");
print_help_msg();
exit(1)
}

View File

@@ -171,7 +171,7 @@ impl<T, E: Display> Loggable<T> for Result<T, E> {
write!(w, "[{}:{}] ", caller.file(), caller.line())?;
}
f(w)?;
writeln!(w, ": {:#}", e)
writeln!(w, ": {e:#}")
});
Err(LoggedError::default())
}
@@ -366,7 +366,7 @@ impl Display for OsError<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let error = self.as_io_error();
if self.name.is_empty() {
write!(f, "{:#}", error)
write!(f, "{error:#}")
} else {
match (self.arg1.ok(), self.arg2.ok()) {
(Some(arg1), Some(arg2)) => {