rust/compiler/rustc_mir/src/transform/coverage
Tyler Mandry 17ec4b8258
Rollup merge of #79809 - Eric-Arellano:split-once, r=matklad
Dogfood `str_split_once()`

Part of https://github.com/rust-lang/rust/issues/74773.

Beyond increased clarity, this fixes some instances of a common confusion with how `splitn(2)` behaves: the first element will always be `Some()`, regardless of the delimiter, and even if the value is empty.

Given this code:

```rust
fn main() {
    let val = "...";
    let mut iter = val.splitn(2, '=');
    println!("Input: {:?}, first: {:?}, second: {:?}", val, iter.next(), iter.next());
}
```

We get:

```
Input: "no_delimiter", first: Some("no_delimiter"), second: None
Input: "k=v", first: Some("k"), second: Some("v")
Input: "=", first: Some(""), second: Some("")
```

Using `str_split_once()` makes more clear what happens when the delimiter is not found.
2020-12-10 21:33:08 -08:00
..
test_macros Addressed feedback 2020-11-13 09:07:39 -08:00
counters.rs Added a unit test for BcbCounters 2020-11-12 16:22:25 -08:00
debug.rs Review feedback 2020-12-08 12:51:00 -07:00
graph.rs Fixes to Rust coverage 2020-12-07 17:56:19 -08:00
mod.rs Fixes to Rust coverage 2020-12-07 17:56:19 -08:00
query.rs Combination of commits 2020-12-03 09:50:10 -08:00
spans.rs Fixes to Rust coverage 2020-12-07 17:56:19 -08:00
tests.rs Addressed feedback 2020-11-13 09:07:39 -08:00