Clarify text for add_braces assist

"to arm expression" is hard to parse, because "arm" can be a verb. Not
all Rust users may know that "arm" refers to a `match` expression
either.

Tweak the wording to make the sentence easier to parse, and clarify
that this assist refers to `match`. Use the same wording style for the
closure version too.
This commit is contained in:
Wilfred Hughes 2025-04-25 22:15:22 -07:00
parent df594ba8f4
commit eb23af9e73

View File

@ -7,7 +7,7 @@ use crate::{AssistContext, AssistId, Assists};
// Assist: add_braces
//
// Adds braces to lambda and match arm expressions.
// Adds braces to closure bodies and match arm expressions.
//
// ```
// fn foo(n: i32) -> i32 {
@ -34,8 +34,8 @@ pub(crate) fn add_braces(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
acc.add(
AssistId::refactor_rewrite("add_braces"),
match expr_type {
ParentType::ClosureExpr => "Add braces to closure body",
ParentType::MatchArmExpr => "Add braces to arm expression",
ParentType::ClosureExpr => "Add braces to this closure body",
ParentType::MatchArmExpr => "Add braces to this match arm expression",
},
expr.syntax().text_range(),
|builder| {