clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

This commit is contained in:
Yoshitomo Nakanishi 2021-04-01 10:39:44 +09:00
parent 8cf7d9b037
commit 6325fe1f54
5 changed files with 44 additions and 6 deletions

View file

@ -27,7 +27,7 @@ fn check_ln1p() {
let _ = (x / 2.0).ln_1p();
let _ = x.powi(3).ln_1p();
let _ = (x.powi(3) / 2.0).ln_1p();
let _ = ((std::f32::consts::E - 1.0)).ln_1p();
let _ = (std::f32::consts::E - 1.0).ln_1p();
let _ = x.ln_1p();
let _ = x.powi(3).ln_1p();
let _ = (x + 2.0).ln_1p();

View file

@ -90,7 +90,7 @@ error: ln(1 + x) can be computed more accurately
--> $DIR/floating_point_log.rs:30:13
|
LL | let _ = (1.0 + (std::f32::consts::E - 1.0)).ln();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `((std::f32::consts::E - 1.0)).ln_1p()`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(std::f32::consts::E - 1.0).ln_1p()`
error: ln(1 + x) can be computed more accurately
--> $DIR/floating_point_log.rs:31:13

View file

@ -28,7 +28,7 @@ error: this call to `from_str_radix` can be replaced with a call to `str::parse`
--> $DIR/from_str_radix_10.rs:32:5
|
LL | u16::from_str_radix(&("10".to_owned() + "5"), 10)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(("10".to_owned() + "5")).parse::<u16>()`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("10".to_owned() + "5").parse::<u16>()`
error: this call to `from_str_radix` can be replaced with a call to `str::parse`
--> $DIR/from_str_radix_10.rs:33:5

View file

@ -43,7 +43,7 @@ LL | / for i in 3..(3 + src.len()) {
LL | | dst[i] = src[count];
LL | | count += 1;
LL | | }
| |_____^ help: try replacing the loop by: `dst[3..((3 + src.len()))].clone_from_slice(&src[..((3 + src.len()) - 3)]);`
| |_____^ help: try replacing the loop by: `dst[3..(3 + src.len())].clone_from_slice(&src[..((3 + src.len()) - 3)]);`
error: it looks like you're manually copying between slices
--> $DIR/with_loop_counters.rs:35:5