about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-3/+3
2020-04-25Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-SimulacrumDylan DPC-8/+3
Replace filter_map().next() calls with find_map() These are semantically the same, but `find_map()` is more concise.
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-8/+3
These are semantically the same, but `find_map()` is more concise.
2020-04-24Avoid unused Option::map resultsJosh Stone-2/+2
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-23Fix librustdoc error due to `as_local_hir_id` changesmarmeladema-2/+2
2020-04-23Update LangString::parse usage in markdown testsGuillaume Gomez-1/+1
2020-04-23Create new rustdoc lint to check for code blocks tagsGuillaume Gomez-4/+114
2020-04-20Rollup merge of #71250 - GuillaumeGomez:use-json-instead-of-js, r=kinnisonDylan DPC-5/+41
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
2020-04-17Replace big JS dict with JSON parsingGuillaume Gomez-5/+41
2020-04-16Dogfood or_patterns in rustdocJosh Stone-12/+11
2020-04-16Rollup merge of #70990 - GuillaumeGomez:rustdoc-cleanup, r=ollie27Dylan DPC-5/+5
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
2020-04-13Rollup merge of #70656 - GuillaumeGomez:scrollbar-display, r=kinnisonDylan DPC-0/+64
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: ![old-firefox-light](https://user-images.githubusercontent.com/3050060/78148718-7bf58c80-7435-11ea-93d3-2a2cafd5c6ae.png) ![firefox-light](https://user-images.githubusercontent.com/3050060/78148736-7f891380-7435-11ea-8b10-a8898f73b4c9.png) And on chrome: ![chrome-light](https://user-images.githubusercontent.com/3050060/78148903-ac3d2b00-7435-11ea-9a10-6c0376a675c3.png) ![chrome-dark](https://user-images.githubusercontent.com/3050060/78148907-ae9f8500-7435-11ea-9b89-0397b977753c.png) Small extra question: should I extend it to all scrollbars? I think it'd be better but just in case... r? @kinnison
2020-04-10Improve rustdoc source code a bitGuillaume Gomez-5/+5
2020-04-08rustdoc: Don't try to load source files from external cratesOliver Middleton-5/+6
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
2020-04-07Extend sidebar scrollbar changes to all scrollbarsGuillaume Gomez-13/+41
2020-04-07Improve scrollbar display in rustdocGuillaume Gomez-0/+36
2020-03-31more clippy fixesMatthias Krüger-73/+65
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)
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-3/+3
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-3/+3
2020-03-28Fix rustdoc.css CSS tab-size property0xd4d-2/+2
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-3/+2
(clippy::let_and_return)
2020-03-19Auto merge of #69402 - GuillaumeGomez:extend-search, r=kinnisonbors-88/+155
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
2020-03-19Rollup merge of #70005 - GuillaumeGomez:code-block-signs, r=kinnisonMazdak Farrokhzad-13/+21
[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: ![old-light](https://user-images.githubusercontent.com/3050060/76687070-f1cdbb80-6620-11ea-9b73-0c787dc671f7.png) ![old-dark](https://user-images.githubusercontent.com/3050060/76687079-f4c8ac00-6620-11ea-90fb-e548329e01b4.png) And now it looks like this: ![new-light](https://user-images.githubusercontent.com/3050060/76687092-fd20e700-6620-11ea-9ebb-2b6852f00899.png) ![new-dark](https://user-images.githubusercontent.com/3050060/76687091-fd20e700-6620-11ea-8fea-6854c8367b97.png) cc @rust-lang/rustdoc r? @kinnison
2020-03-17Update rustdoc test and remove TODO commentGuillaume Gomez-1/+0
2020-03-16Update src/librustdoc/html/static/main.js Guillaume Gomez-1/+1
Fix variable name Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-16Rename render::Type to improve namingGuillaume Gomez-8/+8
2020-03-16formattingGuillaume Gomez-27/+24
2020-03-16Support type search for arguments and returned typesGuillaume Gomez-87/+157
2020-03-15Add FIXME notevarkor-1/+1
2020-03-15Render full attributes in rustdocvarkor-22/+2
2020-03-14Make ignore and compile fail signs more visibleGuillaume Gomez-13/+21
2020-03-14Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPCYuki Okushi-40/+34
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)
2020-03-11Rollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27Mazdak Farrokhzad-1/+3
--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
2020-03-10Auto merge of #66364 - Centril:cleanup-macro-def, r=petrochenkov,eddybbors-2/+2
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
2020-03-10Store `TokenStream` in `rmeta::MacroDef`.Mazdak Farrokhzad-2/+2
This removes a hack from `load_macro_untracked` in which parsing is used.
2020-03-10Rollup merge of #69514 - GuillaumeGomez:remove-spotlight, r=kinnisonMazdak Farrokhzad-280/+7
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
2020-03-07rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes)Matthias Krüger-28/+28
2020-03-07iterate over a maps values directly. (clippy::for_kv_map)Matthias Krüger-1/+1
2020-03-07Use ?-operator in more places (clippy::question_mark, had some false ↵Matthias Krüger-5/+1
negatives fixed recently)
2020-03-07rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some)Matthias Krüger-5/+3
2020-03-07rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)Matthias Krüger-1/+1
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-05Rollup merge of #69736 - matthiaskrgr:even_more_clippy, r=Dylan-DPCDylan DPC-14/+10
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)
2020-03-05Use simple 'for i in x' loops instead of 'while let Some(x) = x.next()' ↵Matthias Krüger-6/+2
loops on iterators. (clippy::while_let_on_iterator)
2020-03-05Const items have by default a static lifetime, there's no need to annotate ↵Matthias Krüger-6/+6
it. (clippy::redundant_static_lifetimes)
2020-03-05Remove redundant patterns when matching ( x @ _ to x) ↵Matthias Krüger-2/+2
(clippy::redundant_pattern)
2020-03-04Use .as_deref() instead of .as_ref().map(Deref::deref) ↵Matthias Krüger-2/+2
(clippy::option_as_ref_deref)
2020-03-02Put back output-format option for show-coverageGuillaume Gomez-1/+3
2020-03-01Rollup merge of #69598 - ollie27:rustdoc_crate-version_escape, r=GuillaumeGomezDylan DPC-2/+3
rustdoc: HTML escape crate version As `--crate-version` accepts arbitrary strings they need to be escaped. r? @GuillaumeGomez
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-3/+3
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.