rust/src/librustdoc/html
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
..
highlight Add test to ensure that no DOS backline (\r\n) doesn't create extra backline in source rendering 2020-11-15 20:57:20 +01:00
markdown Render Markdown in search results 2020-12-03 14:11:37 -08:00
render Dogfood 'str_split_once() with librustdoc 2020-12-07 14:00:31 -07:00
static Rollup merge of #79862 - GuillaumeGomez:tab-lock, r=Manishearth 2020-12-09 13:38:38 -08:00
toc Format the world 2019-12-22 17:42:47 -05:00
escape.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
format.rs Add from_def_id_and_kind reducing duplication in rustdoc 2020-11-17 15:16:03 -05:00
highlight.rs Rollup merge of #79069 - jyn514:class-none, r=GuillaumeGomez 2020-11-17 16:13:51 +01:00
layout.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
markdown.rs use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some) 2020-12-08 20:27:48 +01:00
mod.rs Make markdown module public for doc-tests 2020-11-15 11:21:13 -05:00
sources.rs Make fold_item_recur non-nullable 2020-11-22 12:59:01 -05:00
static_files.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
toc.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00