From 6e2297fde014ea5a89765bde4ade220b8f50fd7d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Apr 2022 15:47:57 -0700 Subject: [PATCH] Resolve clippy::needless_question_mark error: question mark operator is useless here --> src/helpers.rs:86:16 | 86 | return Ok(const_val.check_init()?); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `const_val.check_init()` | = note: `-D clippy::needless-question-mark` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark --- src/helpers.rs | 2 +- src/lib.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index 1d84b3fdf16..b9ac4afff36 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -83,7 +83,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let cid = GlobalId { instance, promoted: None }; let const_val = this.eval_to_allocation(cid)?; let const_val = this.read_scalar(&const_val.into())?; - return Ok(const_val.check_init()?); + const_val.check_init() } /// Helper function to get a `libc` constant as a `Scalar`. diff --git a/src/lib.rs b/src/lib.rs index 598d9cc96ae..cd40fa41976 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,6 @@ clippy::if_same_then_else, clippy::manual_map, clippy::needless_lifetimes, - clippy::needless_question_mark, clippy::needless_return, clippy::new_without_default, clippy::op_ref,