Skip to content

Commit 2d7727f

Browse files
bors[bot]Veykril
andauthored
Merge #9553
9553: minor: Disambiguate replace with if let assist labels r=Veykril a=Veykril Turns out we have two assists for replacing something with `if let` constructs, so having the cursor on a `let` keyword inside a match gave you two identical assist labels which is rather confusing. bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 4337f5e + 0796288 commit 2d7727f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

crates/ide_assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
8282
let target = if_expr.syntax().text_range();
8383
acc.add(
8484
AssistId("replace_if_let_with_match", AssistKind::RefactorRewrite),
85-
"Replace with match",
85+
"Replace if let with match",
8686
target,
8787
move |edit| {
8888
let match_expr = {
@@ -195,7 +195,7 @@ pub(crate) fn replace_match_with_if_let(acc: &mut Assists, ctx: &AssistContext)
195195
let target = match_expr.syntax().text_range();
196196
acc.add(
197197
AssistId("replace_match_with_if_let", AssistKind::RefactorRewrite),
198-
"Replace with if let",
198+
"Replace match with if let",
199199
target,
200200
move |edit| {
201201
let condition = make::condition(scrutinee, Some(if_let_pat));

crates/ide_assists/src/handlers/replace_let_with_if_let.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
1414

1515
// Assist: replace_let_with_if_let
1616
//
17-
// Replaces `let` with an `if-let`.
17+
// Replaces `let` with an `if let`.
1818
//
1919
// ```
2020
// # enum Option<T> { Some(T), None }
@@ -45,7 +45,7 @@ pub(crate) fn replace_let_with_if_let(acc: &mut Assists, ctx: &AssistContext) ->
4545
let target = let_kw.text_range();
4646
acc.add(
4747
AssistId("replace_let_with_if_let", AssistKind::RefactorRewrite),
48-
"Replace with if-let",
48+
"Replace let with if let",
4949
target,
5050
|edit| {
5151
let ty = ctx.sema.type_of_expr(&init);

crates/ide_assists/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub fn test_some_range(a: int) -> bool {
246246
Convert integer base
247247
Extract into variable
248248
Extract into function
249-
Replace with match
249+
Replace if let with match
250250
"#]]
251251
.assert_eq(&expected);
252252
}
@@ -275,7 +275,7 @@ pub fn test_some_range(a: int) -> bool {
275275
Convert integer base
276276
Extract into variable
277277
Extract into function
278-
Replace with match
278+
Replace if let with match
279279
"#]]
280280
.assert_eq(&expected);
281281
}

0 commit comments

Comments
 (0)