]> git.lizzy.rs Git - rust.git/commitdiff
simplify
authorLukas Wirth <lukastw97@gmail.com>
Thu, 17 Jun 2021 15:46:06 +0000 (17:46 +0200)
committerLukas Wirth <lukastw97@gmail.com>
Thu, 17 Jun 2021 15:58:26 +0000 (17:58 +0200)
crates/ide_assists/src/handlers/inline_local_variable.rs
crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt

index bf4ba16f0ed796775414e39b197afba77156ed4f..945d286503320ef416b346e0982eba7b14952438 100644 (file)
@@ -65,10 +65,9 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
                         Some(u) => u,
                         None => return Some(false),
                     };
-
-                    Some(!matches!(
-                        (&initializer_expr, usage_parent),
-                        (
+                    Some(
+                        !(matches!(
+                            initializer_expr,
                             ast::Expr::CallExpr(_)
                                 | ast::Expr::IndexExpr(_)
                                 | ast::Expr::MethodCallExpr(_)
@@ -82,9 +81,8 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
                                 | ast::Expr::PathExpr(_)
                                 | ast::Expr::BlockExpr(_)
                                 | ast::Expr::EffectExpr(_),
-                            _
-                        ) | (
-                            _,
+                        ) || matches!(
+                            usage_parent,
                             ast::Expr::CallExpr(_)
                                 | ast::Expr::TupleExpr(_)
                                 | ast::Expr::ArrayExpr(_)
@@ -94,8 +92,8 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
                                 | ast::Expr::BreakExpr(_)
                                 | ast::Expr::ReturnExpr(_)
                                 | ast::Expr::MatchExpr(_)
-                        )
-                    ))
+                        )),
+                    )
                 })
                 .collect::<Option<_>>()
                 .map(|b| (file_id, b))
index d5ab03576de916365eacb3e50fa8df2a3eb7b7ba..a7f936a703e33f871da26f79c3da6dd038f750de 100644 (file)
@@ -54,7 +54,7 @@
             source: Some(
                 "rustc",
             ),
-            message: "can\'t compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`",
+            message: "can't compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`",
             related_information: None,
             tags: None,
             data: None,
index ada540ea653f0f4974abd7d4be81b8897049ccc1..afc562a0e2bee18f012f5f390075af1b1cc710d6 100644 (file)
@@ -54,7 +54,7 @@
             source: Some(
                 "rustc",
             ),
-            message: "method `next` has an incompatible type for trait\nexpected type `fn(&mut ty::list_iter::ListIterator<\'list, M>) -> std::option::Option<&ty::Ref<M>>`\n   found type `fn(&ty::list_iter::ListIterator<\'list, M>) -> std::option::Option<&\'list ty::Ref<M>>`",
+            message: "method `next` has an incompatible type for trait\nexpected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref<M>>`\n   found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref<M>>`",
             related_information: None,
             tags: None,
             data: None,