about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohann Hemmann <johann.hemmann@code.berlin>2024-01-19 16:29:07 +0100
committerJohann Hemmann <johann.hemmann@code.berlin>2024-01-19 17:31:01 +0100
commit3cf1358eb81f24d2e2e5394b938280799e4bde5e (patch)
tree12b2508bae0555fa55fee9d9ec19f329373572e0
parent6738edc25907be3926a83bf55d74b00fafb79637 (diff)
downloadrust-3cf1358eb81f24d2e2e5394b938280799e4bde5e.tar.gz
rust-3cf1358eb81f24d2e2e5394b938280799e4bde5e.zip
question_mark
-rw-r--r--Cargo.toml2
-rw-r--r--crates/hir/src/lib.rs4
-rw-r--r--crates/hir/src/semantics.rs6
-rw-r--r--crates/ide-assists/src/handlers/convert_match_to_let_else.rs2
4 files changed, 4 insertions, 10 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 35106e7efb5..11b33694699 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -159,8 +159,6 @@ suspicious = { level = "warn", priority = -1 }
 result_unit_err = "allow"
 # We don't expose public APIs that matter like this
 len_without_is_empty = "allow"
-# We currently prefer explicit control flow return over `...?;` statements whose result is unused
-question_mark = "allow"
 # We have macros that rely on this currently
 enum_variant_names = "allow"
 # Builder pattern disagrees
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 3ec60ca69ed..b75c4bb36db 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -2081,9 +2081,7 @@ impl Function {
     }
 
     pub fn method_params(self, db: &dyn HirDatabase) -> Option<Vec<Param>> {
-        if self.self_param(db).is_none() {
-            return None;
-        }
+        self.self_param(db)?;
         Some(self.params_without_self(db))
     }
 
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 1f26d0c1543..fdb94a6d5a7 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -659,10 +659,8 @@ impl<'db> SemanticsImpl<'db> {
                     // First expand into attribute invocations
                     let containing_attribute_macro_call = self.with_ctx(|ctx| {
                         token.parent_ancestors().filter_map(ast::Item::cast).find_map(|item| {
-                            if item.attrs().next().is_none() {
-                                // Don't force populate the dyn cache for items that don't have an attribute anyways
-                                return None;
-                            }
+                            // Don't force populate the dyn cache for items that don't have an attribute anyways
+                            item.attrs().next()?;
                             Some((
                                 ctx.item_to_macro_call(InFile::new(file_id, item.clone()))?,
                                 item,
diff --git a/crates/ide-assists/src/handlers/convert_match_to_let_else.rs b/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
index 5657f2dbfb3..c7f41ffce04 100644
--- a/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
+++ b/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
@@ -38,7 +38,7 @@ pub(crate) fn convert_match_to_let_else(acc: &mut Assists, ctx: &AssistContext<'
     let Some(ast::Expr::MatchExpr(initializer)) = let_stmt.initializer() else { return None };
     let initializer_expr = initializer.expr()?;
 
-    let Some((extracting_arm, diverging_arm)) = find_arms(ctx, &initializer) else { return None };
+    let (extracting_arm, diverging_arm) = find_arms(ctx, &initializer)?;
     if extracting_arm.guard().is_some() {
         cov_mark::hit!(extracting_arm_has_guard);
         return None;