Skip to content

Commit e39356e

Browse files
committed
Fixed some new usage of format! incompatible with older versions of rustc introduced in some commit in crates/ide/src/convert_let_else_to_match.rs file
1 parent ac56b19 commit e39356e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub(crate) fn convert_let_else_to_match(acc: &mut Assists, ctx: &AssistContext)
147147
// remove the mut from the pattern
148148
for (b, ismut) in binders.iter() {
149149
if *ismut {
150-
pat_no_mut = pat_no_mut.replace(&format!("mut {b}"), &b.to_string());
150+
pat_no_mut = pat_no_mut.replace(&format!("mut {}", b), &b.to_string());
151151
}
152152
}
153153

@@ -158,17 +158,17 @@ pub(crate) fn convert_let_else_to_match(acc: &mut Assists, ctx: &AssistContext)
158158
};
159159
let replace = if binders.is_empty() {
160160
format!(
161-
"match {init_expr} {{
162-
{indent1}{pat_no_mut} => {binders_str}
163-
{indent1}_ => {branch2}
164-
{indent}}}"
161+
"match {} {{
162+
{}{} => {}
163+
{}_ => {}
164+
{}}}", init_expr, indent1, pat_no_mut, binders_str, indent1, branch2, indent
165165
)
166166
} else {
167167
format!(
168-
"let {binders_str_mut} = match {init_expr} {{
169-
{indent1}{pat_no_mut} => {binders_str},
170-
{indent1}_ => {branch2}
171-
{indent}}};"
168+
"let {} = match {} {{
169+
{}{} => {},
170+
{}_ => {}
171+
{}}};", binders_str_mut, init_expr, indent1, pat_no_mut, binders_str, indent1, branch2, indent
172172
)
173173
};
174174
edit.replace(target, replace);

0 commit comments

Comments
 (0)