diff options
| author | hotate29 <hotate_oc@yahoo.co.jp> | 2021-12-24 23:54:15 +0900 |
|---|---|---|
| committer | hotate29 <hotate_oc@yahoo.co.jp> | 2021-12-25 02:02:37 +0900 |
| commit | 07b6927180915ed6a8379c8cc9bec069d13ff0dc (patch) | |
| tree | e943ed85ccee4246ecd7f92651f7803359ee3ae2 | |
| parent | 45a3b51c6d52ba6bb0c2e0b1e45c687b54419cb3 (diff) | |
| download | rust-07b6927180915ed6a8379c8cc9bec069d13ff0dc.tar.gz rust-07b6927180915ed6a8379c8cc9bec069d13ff0dc.zip | |
Change ```floating_point_arthmetic::detect_hypot()``` to enclose the expression in parentheses.
| -rw-r--r-- | clippy_lints/src/floating_point_arithmetic.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/floating_point_arithmetic.rs b/clippy_lints/src/floating_point_arithmetic.rs index 2de2bfc040b..06cd78582bb 100644 --- a/clippy_lints/src/floating_point_arithmetic.rs +++ b/clippy_lints/src/floating_point_arithmetic.rs @@ -356,7 +356,7 @@ fn detect_hypot(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<String> { if eq_expr_value(cx, lmul_lhs, lmul_rhs); if eq_expr_value(cx, rmul_lhs, rmul_rhs); then { - return Some(format!("{}.hypot({})", Sugg::hir(cx, lmul_lhs, ".."), Sugg::hir(cx, rmul_lhs, ".."))); + return Some(format!("{}.hypot({})", Sugg::hir(cx, lmul_lhs, "..").maybe_par(), Sugg::hir(cx, rmul_lhs, ".."))); } } @@ -379,7 +379,7 @@ fn detect_hypot(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<String> { if let Some((rvalue, _)) = constant(cx, cx.typeck_results(), rargs_1); if Int(2) == lvalue && Int(2) == rvalue; then { - return Some(format!("{}.hypot({})", Sugg::hir(cx, largs_0, ".."), Sugg::hir(cx, rargs_0, ".."))); + return Some(format!("{}.hypot({})", Sugg::hir(cx, largs_0, "..").maybe_par(), Sugg::hir(cx, rargs_0, ".."))); } } } |
