diff options
author | Lukas Wirth <[email protected]> | 2021-06-17 16:46:06 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-17 16:58:26 +0100 |
commit | b6cb6d5abeca51abc7e805d847f3bf3b4ba71151 (patch) | |
tree | aa511e74de1328176d5da79c0310dc603fcf85ff | |
parent | 95c8c65139c10e4de44367fead8dff88511e6d46 (diff) |
simplify
3 files changed, 9 insertions, 11 deletions
diff --git a/crates/ide_assists/src/handlers/inline_local_variable.rs b/crates/ide_assists/src/handlers/inline_local_variable.rs index bf4ba16f0..945d28650 100644 --- a/crates/ide_assists/src/handlers/inline_local_variable.rs +++ b/crates/ide_assists/src/handlers/inline_local_variable.rs | |||
@@ -65,10 +65,9 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
65 | Some(u) => u, | 65 | Some(u) => u, |
66 | None => return Some(false), | 66 | None => return Some(false), |
67 | }; | 67 | }; |
68 | 68 | Some( | |
69 | Some(!matches!( | 69 | !(matches!( |
70 | (&initializer_expr, usage_parent), | 70 | initializer_expr, |
71 | ( | ||
72 | ast::Expr::CallExpr(_) | 71 | ast::Expr::CallExpr(_) |
73 | | ast::Expr::IndexExpr(_) | 72 | | ast::Expr::IndexExpr(_) |
74 | | ast::Expr::MethodCallExpr(_) | 73 | | ast::Expr::MethodCallExpr(_) |
@@ -82,9 +81,8 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
82 | | ast::Expr::PathExpr(_) | 81 | | ast::Expr::PathExpr(_) |
83 | | ast::Expr::BlockExpr(_) | 82 | | ast::Expr::BlockExpr(_) |
84 | | ast::Expr::EffectExpr(_), | 83 | | ast::Expr::EffectExpr(_), |
85 | _ | 84 | ) || matches!( |
86 | ) | ( | 85 | usage_parent, |
87 | _, | ||
88 | ast::Expr::CallExpr(_) | 86 | ast::Expr::CallExpr(_) |
89 | | ast::Expr::TupleExpr(_) | 87 | | ast::Expr::TupleExpr(_) |
90 | | ast::Expr::ArrayExpr(_) | 88 | | ast::Expr::ArrayExpr(_) |
@@ -94,8 +92,8 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
94 | | ast::Expr::BreakExpr(_) | 92 | | ast::Expr::BreakExpr(_) |
95 | | ast::Expr::ReturnExpr(_) | 93 | | ast::Expr::ReturnExpr(_) |
96 | | ast::Expr::MatchExpr(_) | 94 | | ast::Expr::MatchExpr(_) |
97 | ) | 95 | )), |
98 | )) | 96 | ) |
99 | }) | 97 | }) |
100 | .collect::<Option<_>>() | 98 | .collect::<Option<_>>() |
101 | .map(|b| (file_id, b)) | 99 | .map(|b| (file_id, b)) |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt index d5ab03576..a7f936a70 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt | |||
@@ -54,7 +54,7 @@ | |||
54 | source: Some( | 54 | source: Some( |
55 | "rustc", | 55 | "rustc", |
56 | ), | 56 | ), |
57 | message: "can\'t compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", | 57 | message: "can't compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", |
58 | related_information: None, | 58 | related_information: None, |
59 | tags: None, | 59 | tags: None, |
60 | data: None, | 60 | data: None, |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt index ada540ea6..afc562a0e 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt | |||
@@ -54,7 +54,7 @@ | |||
54 | source: Some( | 54 | source: Some( |
55 | "rustc", | 55 | "rustc", |
56 | ), | 56 | ), |
57 | 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>>`", | 57 | 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>>`", |
58 | related_information: None, | 58 | related_information: None, |
59 | tags: None, | 59 | tags: None, |
60 | data: None, | 60 | data: None, |