make a bunch of lints texts adhere to rustc dev guide
According to the rustc-dev guide: "The text should be matter of fact and avoid capitalization and periods, unless multiple sentences are needed"
changelog: make some lint output adhere to the rustc-dev guide
Avoid or_fun_call for const_fn with no args
Based on #5682 by @lzutao
This avoids a subset of false positives, specifically those related to `const fn`s that take no arguments.
For the rest, a much more involved fix would be needed, see https://github.com/rust-lang/rust-clippy/pull/5682#issuecomment-638681210.
So this does *not* solve #5658
changelog: Avoid triggering [`or_fun_call`] with `const fn`s that take no arguments.
Fixes#5886
Rollup of 5 pull requests
Successful merges:
- #5825 (Add the new lint `same_item_push`)
- #5869 (New lint against `Self` as an arbitrary self type)
- #5870 (enable #[allow(clippy::unsafe_derive_deserialize)])
- #5871 (Lint .min(x).max(y) with x < y)
- #5874 (Make the docs clearer for new contributors)
Failed merges:
r? @ghost
changelog: rollup
Make the docs clearer for new contributors
It confused me before, so I made it extra obvious that you need to run
a script to set up your toolchain before you can build Clippy.
I also added a note so that new contributors aren't confused when
Clippy doesn't build as a result of a change in rustc's internals.
changelog: make `CONTRIBUTING.md` clearer for new contributors
enable #[allow(clippy::unsafe_derive_deserialize)]
Before this change this lint could not be allowed as the code we are checking is automatically generated.
changelog: Enable using the `allow` attribute on top of an ADT linted by [`unsafe_derive_deserialize`].
Fixes: #5789
Fix ICE in `loops` module
changelog: Fix ICE related to `needless_collect` when a call to `iter()` was not present.
I went for restoring the old suggestion of `next().is_some()` over `get(0).is_some()` given that `iter()` is not necessarily present (could be e.g. `into_iter()` or `iter_mut()`) and that the old suggestion could change semantics, e.g. a call to `filter()` could be present between `iter()` and the collect part.
Fixes#5872
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.
All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.
`contains_feature_attr()` was dead, and is removed.
Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`
* Add an easy-to-see note at the top of `CONTRIBUTING.md` that points
new contributors to the Basics docs
* Add a note about compiler errors as a result of internals changes
that break Clippy