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 <lukastw97@gmail.com>
This commit is contained in:
commit
2d7727fe31
@ -82,7 +82,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
|
||||
let target = if_expr.syntax().text_range();
|
||||
acc.add(
|
||||
AssistId("replace_if_let_with_match", AssistKind::RefactorRewrite),
|
||||
"Replace with match",
|
||||
"Replace if let with match",
|
||||
target,
|
||||
move |edit| {
|
||||
let match_expr = {
|
||||
@ -195,7 +195,7 @@ pub(crate) fn replace_match_with_if_let(acc: &mut Assists, ctx: &AssistContext)
|
||||
let target = match_expr.syntax().text_range();
|
||||
acc.add(
|
||||
AssistId("replace_match_with_if_let", AssistKind::RefactorRewrite),
|
||||
"Replace with if let",
|
||||
"Replace match with if let",
|
||||
target,
|
||||
move |edit| {
|
||||
let condition = make::condition(scrutinee, Some(if_let_pat));
|
||||
|
@ -14,7 +14,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
// Assist: replace_let_with_if_let
|
||||
//
|
||||
// Replaces `let` with an `if-let`.
|
||||
// Replaces `let` with an `if let`.
|
||||
//
|
||||
// ```
|
||||
// # enum Option<T> { Some(T), None }
|
||||
@ -45,7 +45,7 @@ pub(crate) fn replace_let_with_if_let(acc: &mut Assists, ctx: &AssistContext) ->
|
||||
let target = let_kw.text_range();
|
||||
acc.add(
|
||||
AssistId("replace_let_with_if_let", AssistKind::RefactorRewrite),
|
||||
"Replace with if-let",
|
||||
"Replace let with if let",
|
||||
target,
|
||||
|edit| {
|
||||
let ty = ctx.sema.type_of_expr(&init);
|
||||
|
@ -246,7 +246,7 @@ pub fn test_some_range(a: int) -> bool {
|
||||
Convert integer base
|
||||
Extract into variable
|
||||
Extract into function
|
||||
Replace with match
|
||||
Replace if let with match
|
||||
"#]]
|
||||
.assert_eq(&expected);
|
||||
}
|
||||
@ -275,7 +275,7 @@ pub fn test_some_range(a: int) -> bool {
|
||||
Convert integer base
|
||||
Extract into variable
|
||||
Extract into function
|
||||
Replace with match
|
||||
Replace if let with match
|
||||
"#]]
|
||||
.assert_eq(&expected);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user