mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-25 04:23:22 +00:00
6fba89751b
Also fixes some incorrect suggestions for rsplitn
88 lines
3.6 KiB
Text
88 lines
3.6 KiB
Text
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:14:13
|
|
|
|
|
LL | let _ = "key=value".splitn(2, '=').nth(1).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".split_once('=').unwrap().1`
|
|
|
|
|
= note: `-D clippy::manual-split-once` implied by `-D warnings`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:15:13
|
|
|
|
|
LL | let _ = "key=value".splitn(2, '=').skip(1).next().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".split_once('=').unwrap().1`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:16:18
|
|
|
|
|
LL | let (_, _) = "key=value".splitn(2, '=').next_tuple().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".split_once('=')`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:19:13
|
|
|
|
|
LL | let _ = s.splitn(2, '=').nth(1).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.split_once('=').unwrap().1`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:22:13
|
|
|
|
|
LL | let _ = s.splitn(2, '=').nth(1).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.split_once('=').unwrap().1`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:25:13
|
|
|
|
|
LL | let _ = s.splitn(2, '=').skip(1).next().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.split_once('=').unwrap().1`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:28:17
|
|
|
|
|
LL | let _ = s.splitn(2, '=').nth(1)?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.split_once('=')?.1`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:29:17
|
|
|
|
|
LL | let _ = s.splitn(2, '=').skip(1).next()?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.split_once('=')?.1`
|
|
|
|
error: manual implementation of `rsplit_once`
|
|
--> $DIR/manual_split_once.rs:30:17
|
|
|
|
|
LL | let _ = s.rsplitn(2, '=').nth(1)?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.rsplit_once('=')?.0`
|
|
|
|
error: manual implementation of `rsplit_once`
|
|
--> $DIR/manual_split_once.rs:31:17
|
|
|
|
|
LL | let _ = s.rsplitn(2, '=').skip(1).next()?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.rsplit_once('=')?.0`
|
|
|
|
error: manual implementation of `rsplit_once`
|
|
--> $DIR/manual_split_once.rs:39:13
|
|
|
|
|
LL | let _ = "key=value".rsplitn(2, '=').nth(1).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".rsplit_once('=').unwrap().0`
|
|
|
|
error: manual implementation of `rsplit_once`
|
|
--> $DIR/manual_split_once.rs:40:18
|
|
|
|
|
LL | let (_, _) = "key=value".rsplitn(2, '=').next_tuple().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".rsplit_once('=').map(|(x, y)| (y, x))`
|
|
|
|
error: manual implementation of `rsplit_once`
|
|
--> $DIR/manual_split_once.rs:41:13
|
|
|
|
|
LL | let _ = s.rsplitn(2, '=').nth(1);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.rsplit_once('=').map(|x| x.0)`
|
|
|
|
error: manual implementation of `split_once`
|
|
--> $DIR/manual_split_once.rs:52:13
|
|
|
|
|
LL | let _ = "key=value".splitn(2, '=').nth(1).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `"key=value".split_once('=').unwrap().1`
|
|
|
|
error: aborting due to 14 previous errors
|
|
|