Insert parentheses as required

Since the fixed expression is used as a receiver for
`.is_power_of_two()`, it may require parentheses.
This commit is contained in:
Samuel Tardieu 2025-03-24 18:57:58 +01:00
parent bd2cb6a0af
commit 89385c135d
4 changed files with 16 additions and 2 deletions

View file

@ -69,7 +69,7 @@ fn build_sugg(cx: &LateContext<'_>, expr: &Expr<'_>, receiver: &Expr<'_>) {
expr.span,
"manually reimplementing `is_power_of_two`",
"consider using `.is_power_of_two()`",
format!("{snippet}.is_power_of_two()"),
format!("{}.is_power_of_two()", snippet.maybe_paren()),
applicability,
);
}