| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Replace filter_map().next() calls with find_map()
These are semantically the same, but `find_map()` is more concise.
|
|
These are semantically the same, but `find_map()` is more concise.
|
|
These are changes that would be needed if we add `#[must_use]` to
`Option::map`, per #71484.
|
|
|
|
|
|
|
|
Replace big JS dict with JSON parsing
Part of #56545.
@ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had...
I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally:
```bash
$ cargo doc --features doc --open
```
But I strongly recommend to do it with this PR. Some numbers:
* Loading a page with the JSON search-index: less than 1 second
* Loading a page with the JS search-index: crashed after 30 seconds
I think the results are clear enough...
r? @ollie27
cc @rust-lang/rustdoc
|
|
|
|
|
|
Improve rustdoc source code a bit
Very small clean up. I realized that there were too many nested conditions whereas we could just use `and_then`.
r? @kinnison
cc @ollie27
|
|
Improve scrollbar display in rustdoc
The scrollbar of the left sidebar in rustdoc looks very bad on firefox (on dark theme). This PR improves it:
<div style="display:inline-block;">
<div style="width:50%;display:inline-block;float:left;">
<image src="https://user-images.githubusercontent.com/3050060/78148412-202b0380-7435-11ea-8ff3-79f02ea8f9ed.png">
</div>
<div style="width:50%;display:inline-block;float:left;">
<image src="https://user-images.githubusercontent.com/3050060/78148437-28833e80-7435-11ea-946b-a6fc9320b705.png">
</div>
</div>
With light theme:


And on chrome:


Small extra question: should I extend it to all scrollbars? I think it'd be better but just in case...
r? @kinnison
|
|
|
|
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
|
|
|
|
|
|
use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)
|
|
|
|
|
|
|
|
(clippy::let_and_return)
|
|
Extend search
I realized that when looking for "struct:String" in the rustdoc search for example, the "in arguments" and "returned" tabs were always empty. After some investigation, I realized it was because we only provided the name, and not the type, making it impossible to pass the "type filtering" check.
To resolve this, I added the type alongside the name. Note for the future: we could improve this by instead only registering the path id and use the path dictionary directly. The only problem with that solution (which I already tested) is that it becomes complicated for types in other crates. It'd force us to handle both case with an id and a case with `(name, type)`. I found the current PR big enough to not want to provide it directly. However, I think this is definitely worth it to make it work this way in the future.
About the two tests I added: they don't have much interest except checking that we actually have something returned in the search in the cases of a type filtering with and without literal search.
I also had to update a bit the test script to add the new locally global (haha) variable I created (`NO_TYPE_FILTER`). I added this variable to make the code easier to read than just "-1".
r? @kinnison
cc @ollie27
|
|
[rustdoc] Improve visibility for code blocks warnings
It appeared that a lot of people didn't notice when a code block was meant to fail compilation or wasn't tested at all. The changes here make the colors less transparent and the icon bigger. So before it looked like this:


And now it looks like this:


cc @rust-lang/rustdoc
r? @kinnison
|
|
|
|
Fix variable name
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fix more clippy findings
* reduce references on match patterns (clippy::match_ref_pats)
* Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline)
* libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string)
* remove unneeded mutable references (cippy::unnecessary_mut_passed)
* libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast)
* rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes)
* call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref)
* iterate over a maps values directly. (clippy::for_kv_map)
* rustdoc: simplify boolean condition (clippy::nonminimal_bool)
* Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently)
* rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some)
* rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
|
|
--show-coverage json
The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line.
r? @QuietMisdreavus
|
|
Cleanup `rmeta::MacroDef`
Avoid using rountrip parsing in the encoder and in `fn load_macro_untracked`.
The main reason I was interested in this was to remove `rustc_parse` as a dependency of `rustc_metadata` but it seems like this had other benefits as well.
Fixes #49511.
r? @eddyb
cc @matthewjasper @estebank @petrochenkov
|
|
This removes a hack from `load_macro_untracked` in which parsing is used.
|
|
Remove spotlight
I had a few comments saying that this feature was at best misunderstood or not even used so I decided to organize a poll about on [twitter](https://twitter.com/imperioworld_/status/1232769353503956994). After 87 votes, the result is very clear: it's not useful. Considering the amount of code we have just to run it, I think it's definitely worth it to remove it.
r? @kinnison
cc @ollie27
|
|
|
|
|
|
negatives fixed recently)
|
|
|
|
|
|
|
|
even more clippy cleanups
* Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed)
* Use more efficient &&str to String conversion (clippy::inefficient_to_string)
* Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call)
* Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)
* Use simple 'for i in x' loops instead of 'while let Some(i) = x.next()' loops on iterators. (clippy::while_let_on_iterator)
* Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes)
* Remove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern)
|
|
loops on iterators. (clippy::while_let_on_iterator)
|
|
it. (clippy::redundant_static_lifetimes)
|
|
(clippy::redundant_pattern)
|
|
(clippy::option_as_ref_deref)
|
|
|
|
rustdoc: HTML escape crate version
As `--crate-version` accepts arbitrary strings they need to be escaped.
r? @GuillaumeGomez
|
|
Rename `libsyntax` to `librustc_ast`
This was the last rustc crate that wasn't following the `rustc_*` naming convention.
Follow-up to https://github.com/rust-lang/rust/pull/67763.
|