mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Fix clippy for rust 1.52
There are new lints are added in clippy for rust 1.52 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -365,11 +365,9 @@ where
|
||||
.map(|file| {
|
||||
let bf = BufReader::new(file);
|
||||
let mut v = Vec::new();
|
||||
for line in bf.lines() {
|
||||
if let Ok(line) = line {
|
||||
let n = line.trim().parse().unwrap_or(0u64);
|
||||
v.push(n);
|
||||
}
|
||||
for line in bf.lines().flatten() {
|
||||
let n = line.trim().parse().unwrap_or(0u64);
|
||||
v.push(n);
|
||||
}
|
||||
v.into_iter().map(CgroupPid::from).collect()
|
||||
})
|
||||
@@ -383,7 +381,7 @@ where
|
||||
|
||||
// remove_dir aims to remove cgroup path. It does so recursively,
|
||||
// by removing any subdirectories (sub-cgroups) first.
|
||||
fn remove_dir(dir: &PathBuf) -> Result<()> {
|
||||
fn remove_dir(dir: &Path) -> Result<()> {
|
||||
// try the fast path first.
|
||||
if fs::remove_dir(dir).is_ok() {
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user