mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
internal: simplify the process of inserting spaces after mut
This commit is contained in:
parent
8929853df7
commit
ce4ae41605
1 changed files with 9 additions and 17 deletions
|
@ -415,24 +415,16 @@ fn inline(
|
||||||
let expr: &ast::Expr = expr;
|
let expr: &ast::Expr = expr;
|
||||||
|
|
||||||
let mut insert_let_stmt = || {
|
let mut insert_let_stmt = || {
|
||||||
let param_ty = match param_ty {
|
let param_ty = param_ty.clone().map(|param_ty| {
|
||||||
None => None,
|
if sema.hir_file_for(param_ty.syntax()).is_macro() {
|
||||||
Some(param_ty) => {
|
ast::Type::cast(insert_ws_into(param_ty.syntax().clone()))
|
||||||
if sema.hir_file_for(param_ty.syntax()).is_macro() {
|
.unwrap_or_else(|| param_ty)
|
||||||
if let Some(param_ty) =
|
} else {
|
||||||
ast::Type::cast(insert_ws_into(param_ty.syntax().clone()))
|
param_ty
|
||||||
{
|
|
||||||
Some(param_ty)
|
|
||||||
} else {
|
|
||||||
Some(param_ty.clone_for_update())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Some(param_ty.clone_for_update())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
let ty: Option<syntax::ast::Type> =
|
|
||||||
sema.type_of_expr(expr).filter(TypeInfo::has_adjustment).and(param_ty);
|
let ty = sema.type_of_expr(expr).filter(TypeInfo::has_adjustment).and(param_ty);
|
||||||
|
|
||||||
let is_self = param
|
let is_self = param
|
||||||
.name(sema.db)
|
.name(sema.db)
|
||||||
|
|
Loading…
Reference in a new issue