Skip to content

Commit ce4ae41

Browse files
committed
internal: simplify the process of inserting spaces after mut
1 parent 8929853 commit ce4ae41

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

crates/ide-assists/src/handlers/inline_call.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -415,24 +415,16 @@ fn inline(
415415
let expr: &ast::Expr = expr;
416416

417417
let mut insert_let_stmt = || {
418-
let param_ty = match param_ty {
419-
None => None,
420-
Some(param_ty) => {
421-
if sema.hir_file_for(param_ty.syntax()).is_macro() {
422-
if let Some(param_ty) =
423-
ast::Type::cast(insert_ws_into(param_ty.syntax().clone()))
424-
{
425-
Some(param_ty)
426-
} else {
427-
Some(param_ty.clone_for_update())
428-
}
429-
} else {
430-
Some(param_ty.clone_for_update())
431-
}
418+
let param_ty = param_ty.clone().map(|param_ty| {
419+
if sema.hir_file_for(param_ty.syntax()).is_macro() {
420+
ast::Type::cast(insert_ws_into(param_ty.syntax().clone()))
421+
.unwrap_or_else(|| param_ty)
422+
} else {
423+
param_ty
432424
}
433-
};
434-
let ty: Option<syntax::ast::Type> =
435-
sema.type_of_expr(expr).filter(TypeInfo::has_adjustment).and(param_ty);
425+
});
426+
427+
let ty = sema.type_of_expr(expr).filter(TypeInfo::has_adjustment).and(param_ty);
436428

437429
let is_self = param
438430
.name(sema.db)

0 commit comments

Comments
 (0)