mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-11 21:02:34 +00:00
agent: Fix .enumerate
errors during make check
Running `make check` in the `src/agent` directory gives: ``` error: you seem to use `.enumerate()` and immediately discard the index --> rustjail/src/mount.rs:572:27 | 572 | for (_index, line) in reader.lines().enumerate() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_enumerate_index = note: `-D clippy::unused-enumerate-index` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unused_enumerate_index)]` help: remove the `.enumerate()` call | 572 | for line in reader.lines() { | ~~~~ ~~~~~~~~~~~~~~ Checking tokio-native-tls v0.3.1 Checking hyper-tls v0.5.0 Checking reqwest v0.11.18 error: could not compile `rustjail` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... make: *** [../../utils.mk:177: standard_rust_check] Error 101 ``` Fixes: #9342 Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
This commit is contained in:
parent
e1068da1a0
commit
bfb55312be
@ -569,7 +569,7 @@ pub fn parse_mount_table(mountinfo_path: &str) -> Result<Vec<Info>> {
|
|||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
let mut infos = Vec::new();
|
let mut infos = Vec::new();
|
||||||
|
|
||||||
for (_index, line) in reader.lines().enumerate() {
|
for line in reader.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
|
|
||||||
//Example mountinfo format:
|
//Example mountinfo format:
|
||||||
|
@ -180,7 +180,7 @@ pub fn get_mount_fs_type_from_file(mount_file: &str, mount_point: &str) -> Resul
|
|||||||
let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str())?;
|
let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str())?;
|
||||||
|
|
||||||
// Read the file line by line using the lines() iterator from std::io::BufRead.
|
// Read the file line by line using the lines() iterator from std::io::BufRead.
|
||||||
for (_index, line) in content.lines().enumerate() {
|
for line in content.lines() {
|
||||||
if let Some(capes) = re.captures(line) {
|
if let Some(capes) = re.captures(line) {
|
||||||
if capes.len() > 1 {
|
if capes.len() > 1 {
|
||||||
return Ok(capes[1].to_string());
|
return Ok(capes[1].to_string());
|
||||||
@ -225,7 +225,7 @@ pub fn get_cgroup_mounts(
|
|||||||
|
|
||||||
// #subsys_name hierarchy num_cgroups enabled
|
// #subsys_name hierarchy num_cgroups enabled
|
||||||
// fields[0] fields[1] fields[2] fields[3]
|
// fields[0] fields[1] fields[2] fields[3]
|
||||||
'outer: for (_, line) in reader.lines().enumerate() {
|
'outer: for line in reader.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
|
|
||||||
let fields: Vec<&str> = line.split('\t').collect();
|
let fields: Vec<&str> = line.split('\t').collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user