Skip to content

Commit

Permalink
Rollup merge of #89422 - GuillaumeGomez:doctest-whitespace-name, r=Cr…
Browse files Browse the repository at this point in the history
…aftSpider

Replace whitespaces in doctests' name with dashes

Fixes #88263.

Instead of handling white spaces when we filter tests (which would be quite complicated since we split on them!), I propose to instead replace them with dashes.

So for example, this:

```console
test foo.rs - Iter2<T, P>::len (line 13) ... ok
test foo.rs - Iter<T, P>::len (line 4) ... ok
```

becomes:

```console
test foo.rs - Iter<T,-P>::len (line 4) ... ok
test foo.rs - Iter2<T,-P>::len (line 13) ... ok
```

r? `@jyn514`
  • Loading branch information
Manishearth committed Oct 1, 2021
2 parents 1781e4b + 3792be6 commit 04ba153
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ impl Collector {

fn generate_name(&self, line: usize, filename: &FileName) -> String {
let mut item_path = self.names.join("::");
item_path.retain(|c| c != ' ');
if !item_path.is_empty() {
item_path.push(' ');
}
Expand Down

0 comments on commit 04ba153

Please sign in to comment.