runtime-rs:fix cargo clippy

fix cargo clippy

Fixes: #4791
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
Zhongtao Hu 2022-08-02 11:48:39 +08:00
parent 9803393f2f
commit 7247575fa2
3 changed files with 11 additions and 14 deletions

View File

@ -739,18 +739,15 @@ pub fn umount_all<P: AsRef<Path>>(mountpoint: P, lazy_umount: bool) -> Result<()
}
loop {
match umount2(mountpoint.as_ref(), lazy_umount) {
Err(e) => {
// EINVAL is returned if the target is not a mount point, indicating that we are
// done. It can also indicate a few other things (such as invalid flags) which we
// unfortunately end up squelching here too.
if e.kind() == io::ErrorKind::InvalidInput {
break;
} else {
return Err(Error::Umount(mountpoint.as_ref().to_path_buf(), e));
}
if let Err(e) = umount2(mountpoint.as_ref(), lazy_umount) {
// EINVAL is returned if the target is not a mount point, indicating that we are
// done. It can also indicate a few other things (such as invalid flags) which we
// unfortunately end up squelching here too.
if e.kind() == io::ErrorKind::InvalidInput {
break;
} else {
return Err(Error::Umount(mountpoint.as_ref().to_path_buf(), e));
}
Ok(()) => (),
}
}

View File

@ -545,8 +545,8 @@ mod tests {
let msg = format!("test[{}]", i);
// Create a writer for the logger drain to use
let writer =
NamedTempFile::new().unwrap_or_else(|_| panic!("{:}: failed to create tempfile", msg));
let writer = NamedTempFile::new()
.unwrap_or_else(|_| panic!("{:}: failed to create tempfile", msg));
// Used to check file contents before the temp file is unlinked
let mut writer_ref = writer

View File

@ -35,7 +35,7 @@ pub(crate) fn set_logger(path: &str, sid: &str, is_debug: bool) -> Result<slog_a
} else {
log::Level::Info
};
let _ = slog_stdlog::init_with_level(level).context(format!("init with level {}", level))?;
slog_stdlog::init_with_level(level).context(format!("init with level {}", level))?;
Ok(async_guard)
}