From 5c010d489dfcb1a268bde03a644a3af493705480 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] tests: Address Rust 1.51.0 clippy issue (needless_question_mark) error: Question mark operator is useless here --> tests/integration.rs:494:13 | 494 | / Ok(self 495 | | .ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? 496 | | .trim() 497 | | .parse() 498 | | .map_err(Error::Parsing)?) | |__________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark Signed-off-by: Rob Bradford --- tests/integration.rs | 49 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index e8f5d2063..ae91e1f1d 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -475,50 +475,45 @@ mod tests { } fn get_cpu_count(&self) -> Result { - Ok(self - .ssh_command("grep -c processor /proc/cpuinfo")? + self.ssh_command("grep -c processor /proc/cpuinfo")? .trim() .parse() - .map_err(Error::Parsing)?) + .map_err(Error::Parsing) } fn get_initial_apicid(&self) -> Result { - Ok(self - .ssh_command("grep \"initial apicid\" /proc/cpuinfo | grep -o \"[0-9]*\"")? + self.ssh_command("grep \"initial apicid\" /proc/cpuinfo | grep -o \"[0-9]*\"")? .trim() .parse() - .map_err(Error::Parsing)?) + .map_err(Error::Parsing) } fn get_total_memory(&self) -> Result { - Ok(self - .ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? + self.ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? .trim() .parse() - .map_err(Error::Parsing)?) + .map_err(Error::Parsing) } fn get_total_memory_l2(&self) -> Result { - Ok(self - .ssh_command_l2_1("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? + self.ssh_command_l2_1("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")? .trim() .parse() - .map_err(Error::Parsing)?) + .map_err(Error::Parsing) } fn get_numa_node_memory(&self, node_id: usize) -> Result { - Ok(self - .ssh_command( - format!( - "grep MemTotal /sys/devices/system/node/node{}/meminfo \ + self.ssh_command( + format!( + "grep MemTotal /sys/devices/system/node/node{}/meminfo \ | cut -d \":\" -f 2 | grep -o \"[0-9]*\"", - node_id - ) - .as_str(), - )? - .trim() - .parse() - .map_err(Error::Parsing)?) + node_id + ) + .as_str(), + )? + .trim() + .parse() + .map_err(Error::Parsing) } fn wait_vm_boot(&self, custom_timeout: Option) -> Result<(), Error> { @@ -590,11 +585,10 @@ mod tests { } fn get_entropy(&self) -> Result { - Ok(self - .ssh_command("cat /proc/sys/kernel/random/entropy_avail")? + self.ssh_command("cat /proc/sys/kernel/random/entropy_avail")? .trim() .parse() - .map_err(Error::Parsing)?) + .map_err(Error::Parsing) } fn get_pci_bridge_class(&self) -> Result { @@ -4992,8 +4986,7 @@ mod tests { let mut workload_path = dirs::home_dir().unwrap(); workload_path.push("workloads"); - let mut kernels = vec![]; - kernels.push(direct_kernel_boot_path()); + let mut kernels = vec![direct_kernel_boot_path()]; #[cfg(target_arch = "x86_64")] {