From 7c302373edd0e61bf70721fe70bbbf83bd3dfe32 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] vmm: Address Rust 1.51.0 clippy issue (needless_question_mark) warning: Question mark operator is useless here --> vmm/src/seccomp_filters.rs:493:5 | 493 | / Ok(SeccompFilter::new( 494 | | rules.into_iter().collect(), 495 | | SeccompAction::Trap, 496 | | )?) | |_______^ | = note: `#[warn(clippy::needless_question_mark)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark help: try | 493 | SeccompFilter::new( 494 | rules.into_iter().collect(), 495 | SeccompAction::Trap, 496 | ) | warning: Question mark operator is useless here --> vmm/src/seccomp_filters.rs:507:5 | 507 | / Ok(SeccompFilter::new( 508 | | rules.into_iter().collect(), 509 | | SeccompAction::Log, 510 | | )?) | |_______^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark help: try | 507 | SeccompFilter::new( 508 | rules.into_iter().collect(), 509 | SeccompAction::Log, 510 | ) | warning: Question mark operator is useless here --> vmm/src/vm.rs:887:9 | 887 | Ok(CString::new(cmdline).map_err(Error::CmdLineCString)?) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `CString::new(cmdline).map_err(Error::CmdLineCString)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark Signed-off-by: Rob Bradford --- vmm/src/seccomp_filters.rs | 10 ++-------- vmm/src/vm.rs | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/vmm/src/seccomp_filters.rs b/vmm/src/seccomp_filters.rs index b1dc27d7a..f3d61b29e 100644 --- a/vmm/src/seccomp_filters.rs +++ b/vmm/src/seccomp_filters.rs @@ -490,10 +490,7 @@ fn get_seccomp_filter_trap(thread_type: Thread) -> Result Thread::Vmm => vmm_thread_rules()?, }; - Ok(SeccompFilter::new( - rules.into_iter().collect(), - SeccompAction::Trap, - )?) + SeccompFilter::new(rules.into_iter().collect(), SeccompAction::Trap) } fn get_seccomp_filter_log(thread_type: Thread) -> Result { @@ -504,10 +501,7 @@ fn get_seccomp_filter_log(thread_type: Thread) -> Result { Thread::Vmm => vmm_thread_rules()?, }; - Ok(SeccompFilter::new( - rules.into_iter().collect(), - SeccompAction::Log, - )?) + SeccompFilter::new(rules.into_iter().collect(), SeccompAction::Log) } /// Generate a BPF program based on the seccomp_action value diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 7ad05864f..3c0e88ede 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -884,7 +884,7 @@ impl Vm { for entry in self.device_manager.lock().unwrap().cmdline_additions() { cmdline.insert_str(entry).map_err(Error::CmdLineInsertStr)?; } - Ok(CString::new(cmdline).map_err(Error::CmdLineCString)?) + CString::new(cmdline).map_err(Error::CmdLineCString) } #[cfg(target_arch = "aarch64")]