internal: simplify the process of inserting spaces after mut

This commit is contained in:
roife 2024-02-27 12:21:05 +08:00
parent 8929853df7
commit ce4ae41605

View file

@ -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)