diff options
| author | bors <bors@rust-lang.org> | 2022-04-10 17:45:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-10 17:45:19 +0000 |
| commit | 5344236715fafa2b8d27320839f44d0f4b5ca955 (patch) | |
| tree | ae232d0bf09cc55d2fc008cda914a37f35250d08 /src/test/codegen/src-hash-algorithm | |
| parent | c7e68638431b2a6639fcbeb44de790619de3b9b1 (diff) | |
| parent | 6fba89751bfacf59109d37331ec79a8f87ee0aaf (diff) | |
| download | rust-5344236715fafa2b8d27320839f44d0f4b5ca955.tar.gz rust-5344236715fafa2b8d27320839f44d0f4b5ca955.zip | |
Auto merge of #8631 - Alexendoo:splitn-overlap, r=xFrednet
Remove overlap between `manual_split_once` and `needless_splitn`
changelog: Remove overlap between [`manual_split_once`] and [`needless_splitn`]. Fixes some incorrect `rsplitn` suggestions for [`manual_split_once`]
Things that can trigger `needless_splitn` no longer trigger `manual_split_once`, e.g.
```rust
s.[r]splitn(2, '=').next();
s.[r]splitn(2, '=').nth(0);
s.[r]splitn(3, '=').next_tuple();
```
Fixes some suggestions:
```rust
let s = "should not match";
s.rsplitn(2, '.').nth(1);
// old -> Some("should not match")
Some(s.rsplit_once('.').map_or(s, |x| x.0));
// new -> None
s.rsplit_once('.').map(|x| x.0);
s.rsplitn(2, '.').nth(1)?;
// old -> "should not match"
s.rsplit_once('.').map_or(s, |x| x.0);
// new -> early returns
s.rsplit_once('.')?.0;
```
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
