Skip to content

Commit a925768

Browse files
committed
Add dynamic assistant description
1 parent 9e9ea26 commit a925768

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_range_for_to_while.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ pub(crate) fn convert_range_for_to_while(acc: &mut Assists, ctx: &AssistContext<
4343
let body = for_.loop_body()?;
4444
let last = previous_non_trivia_token(body.stmt_list()?.r_curly_token()?)?;
4545

46+
let description = if end.is_some() {
47+
"Replace with while expression"
48+
} else {
49+
"Replace with loop expression"
50+
};
4651
acc.add(
4752
AssistId::refactor("convert_range_for_to_while"),
48-
"Replace to while or loop",
53+
description,
4954
for_.syntax().text_range(),
5055
|builder| {
5156
let mut edit = builder.make_editor(for_.syntax());

0 commit comments

Comments
 (0)