diff options
Diffstat (limited to 'crates/ide_assists/src/handlers/inline_local_variable.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/inline_local_variable.rs | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/crates/ide_assists/src/handlers/inline_local_variable.rs b/crates/ide_assists/src/handlers/inline_local_variable.rs index 2441dbb8b..945d28650 100644 --- a/crates/ide_assists/src/handlers/inline_local_variable.rs +++ b/crates/ide_assists/src/handlers/inline_local_variable.rs | |||
@@ -65,32 +65,35 @@ 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 | (ast::Expr::CallExpr(_), _) | 71 | ast::Expr::CallExpr(_) |
72 | | (ast::Expr::IndexExpr(_), _) | 72 | | ast::Expr::IndexExpr(_) |
73 | | (ast::Expr::MethodCallExpr(_), _) | 73 | | ast::Expr::MethodCallExpr(_) |
74 | | (ast::Expr::FieldExpr(_), _) | 74 | | ast::Expr::FieldExpr(_) |
75 | | (ast::Expr::TryExpr(_), _) | 75 | | ast::Expr::TryExpr(_) |
76 | | (ast::Expr::RefExpr(_), _) | 76 | | ast::Expr::RefExpr(_) |
77 | | (ast::Expr::Literal(_), _) | 77 | | ast::Expr::Literal(_) |
78 | | (ast::Expr::TupleExpr(_), _) | 78 | | ast::Expr::TupleExpr(_) |
79 | | (ast::Expr::ArrayExpr(_), _) | 79 | | ast::Expr::ArrayExpr(_) |
80 | | (ast::Expr::ParenExpr(_), _) | 80 | | ast::Expr::ParenExpr(_) |
81 | | (ast::Expr::PathExpr(_), _) | 81 | | ast::Expr::PathExpr(_) |
82 | | (ast::Expr::BlockExpr(_), _) | 82 | | ast::Expr::BlockExpr(_) |
83 | | (ast::Expr::EffectExpr(_), _) | 83 | | ast::Expr::EffectExpr(_), |
84 | | (_, ast::Expr::CallExpr(_)) | 84 | ) || matches!( |
85 | | (_, ast::Expr::TupleExpr(_)) | 85 | usage_parent, |
86 | | (_, ast::Expr::ArrayExpr(_)) | 86 | ast::Expr::CallExpr(_) |
87 | | (_, ast::Expr::ParenExpr(_)) | 87 | | ast::Expr::TupleExpr(_) |
88 | | (_, ast::Expr::ForExpr(_)) | 88 | | ast::Expr::ArrayExpr(_) |
89 | | (_, ast::Expr::WhileExpr(_)) | 89 | | ast::Expr::ParenExpr(_) |
90 | | (_, ast::Expr::BreakExpr(_)) | 90 | | ast::Expr::ForExpr(_) |
91 | | (_, ast::Expr::ReturnExpr(_)) | 91 | | ast::Expr::WhileExpr(_) |
92 | | (_, ast::Expr::MatchExpr(_)) | 92 | | ast::Expr::BreakExpr(_) |
93 | )) | 93 | | ast::Expr::ReturnExpr(_) |
94 | | ast::Expr::MatchExpr(_) | ||
95 | )), | ||
96 | ) | ||
94 | }) | 97 | }) |
95 | .collect::<Option<_>>() | 98 | .collect::<Option<_>>() |
96 | .map(|b| (file_id, b)) | 99 | .map(|b| (file_id, b)) |