At the `if` branch `filter` (the `let` binding) is `None` iff `filter` (the parameter) was `None`.
We can branch on the parameter, move the binding into the `if`, and the complexity of handling
`Option<Option<_>` largely dissolves.
rustdoc DocFragment rework
Kind of a follow-up of #80119.
A few things are happening in this PR. I'm not sure about the impact on perf though so I'm very interested about that too (if the perf is worse, then we can just close this PR).
The idea here is mostly about reducing the memory usage by relying even more on `Symbol` instead of `String`. The only issue is that `DocFragment` has 3 modifications performed on it:
1. Unindenting
2. Collapsing similar comments into one
3. "Beautifying" (weird JS-like comments handling).
To do so, I saved the information about unindent and the "collapse" is now on-demand (which is why I'm not sure the perf will be better, it has to be run multiple times...).
r? `@jyn514`
Fix search section position on small devices
Fixes#79526.
This is exactly the same issue fixed in 9c36491538 (in https://github.com/rust-lang/rust/pull/79936) but applied to the search section. When the width becomes too small, the search input goes on its own line to get more space, making it go "under" the section following (so either "main" or "search"). The fix is to simply make the section go more under so that it doesn't go over the search input.
r? `@jyn514`
Cleanup markdown span handling, take 2
This PR includes the cleanups made in #80244 except for the removal of `locate()`.
While the biggest conceptual part in #80244 was the removal of `locate()`, it introduced a diagnostic regression.
Additional cleanup:
- Use `RefCell` to avoid building two separate vectors for the links
Work to do:
- [ ] Decide if `locate()` can be simplified by assuming `s` is always in `md`
- [ ] Should probably add some tests that still provide the undesired diagnostics causing #80381
cc `@jyn514` This is the best I can do without patching Pulldown to provide multiple ranges for reference-style links. Also, since `locate` is probably more efficient than `rfind` (at least it's constant time), I decided to not check the link type and just cover every &str as it was before.
Initial support for Rust 2021.
Clippy treated Rust 2021 as Rust 2015, because 2018 was checked with `==` instead of `>=`. This fixes that, such that 2018-specific things are also enabled for 2021.
changelog: Added support for Rust 2021.
`const_generics_defaults`: don't ICE in the unimplemented parts
The thought was that we could use `todo!`s to ensure we wouldn't forget to implement parts of the experimental gate.
However, that can also lead to a suboptimal experience for users as shown in #80589 having both the error/warning about the experimental feature, and the ICE.
Fixes#80589
r? `@varkor`
improve unconditional_panic description
The fact that the lint is triggered by the ConstProp pass is an implementation detail, I do not think that this should be mentioned in the description.
Cc `@oli-obk` `@ehuss`