mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 01:38:13 +00:00
simplify
This commit is contained in:
parent
95c8c65139
commit
b6cb6d5abe
3 changed files with 9 additions and 11 deletions
|
@ -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))
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue