c051656c83
1. Fix the problem of manual_split_once changing the original behavior. 2. Add a new lint needless_splitn. changelog: Fix the problem of manual_split_once changing the original behavior and add a new lint needless_splitn.
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
error: unnecessary use of `splitn`
|
|
--> $DIR/needless_splitn.rs:15:13
|
|
|
|
|
LL | let _ = str.splitn(2, '=').next();
|
|
| ^^^^^^^^^^^^^^^^^^ help: try this: `str.split('=')`
|
|
|
|
|
= note: `-D clippy::needless-splitn` implied by `-D warnings`
|
|
|
|
error: unnecessary use of `splitn`
|
|
--> $DIR/needless_splitn.rs:16:13
|
|
|
|
|
LL | let _ = str.splitn(2, '=').nth(0);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try this: `str.split('=')`
|
|
|
|
error: unnecessary use of `splitn`
|
|
--> $DIR/needless_splitn.rs:19:18
|
|
|
|
|
LL | let (_, _) = str.splitn(3, '=').next_tuple().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^ help: try this: `str.split('=')`
|
|
|
|
error: unnecessary use of `rsplitn`
|
|
--> $DIR/needless_splitn.rs:22:13
|
|
|
|
|
LL | let _ = str.rsplitn(2, '=').next();
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try this: `str.rsplit('=')`
|
|
|
|
error: unnecessary use of `rsplitn`
|
|
--> $DIR/needless_splitn.rs:23:13
|
|
|
|
|
LL | let _ = str.rsplitn(2, '=').nth(0);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try this: `str.rsplit('=')`
|
|
|
|
error: unnecessary use of `rsplitn`
|
|
--> $DIR/needless_splitn.rs:26:18
|
|
|
|
|
LL | let (_, _) = str.rsplitn(3, '=').next_tuple().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try this: `str.rsplit('=')`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|