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 { loop {
match umount2(mountpoint.as_ref(), lazy_umount) { if let Err(e) = umount2(mountpoint.as_ref(), lazy_umount) {
Err(e) => { // EINVAL is returned if the target is not a mount point, indicating that we are
// 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
// done. It can also indicate a few other things (such as invalid flags) which we // unfortunately end up squelching here too.
// unfortunately end up squelching here too. if e.kind() == io::ErrorKind::InvalidInput {
if e.kind() == io::ErrorKind::InvalidInput { break;
break; } else {
} else { return Err(Error::Umount(mountpoint.as_ref().to_path_buf(), e));
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); let msg = format!("test[{}]", i);
// Create a writer for the logger drain to use // Create a writer for the logger drain to use
let writer = let writer = NamedTempFile::new()
NamedTempFile::new().unwrap_or_else(|_| panic!("{:}: failed to create tempfile", msg)); .unwrap_or_else(|_| panic!("{:}: failed to create tempfile", msg));
// Used to check file contents before the temp file is unlinked // Used to check file contents before the temp file is unlinked
let mut writer_ref = writer 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 { } else {
log::Level::Info 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) Ok(async_guard)
} }