Cleanup usage of `span_to_snippet` and `LintContext::sess`
- avoid using `SourceMap::span_to_snippet` directly and use `clippy_utils::source::snippet_opt` instead
- don't use `LintContext::sess()` on `EarlyContext`s which have a `sess` field directly available, saving the import of `LintContext`
changelog: none
Don't emit `too_many_lines` for closures
changelog: don't emit the [`too_many_lines`] lint inside closures to avoir duplicated diagnostics.
Fixes#7517.
fix bug on mutable ref
fixes: #7524
This PR is related to issue #7524
changelog: [`extend_with_drain`] Improve code suggestion for mutable and immutable references
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables
and passes using those tables - primarily privacy checking, stability checking and dead code checking.
All these passes work with definitions rather than with arbitrary HIR nodes.
r? `@cjgillot`
cc `@lambinoo` (#87487)
Updated `define_Conf!` to support multi-line doc comments
Updated the `define_Conf!` macro to support multi-line doc comments for readability. This also enables configuration documentation to have multiple paragraphs.
I've also added the `metadata-collector-lint` feature to the CI build and testing tasks. (I would think that we want this, now that we officially switched over)
---
Now a small informal explanation what this PR changes (just for fun):
* *Once upon a time there was a monster. It was handsome, supportive and happy to dig through the best source code it has ever seen. Spanning over hundreds of lines and reading over complete crates, it was purely marvels!*
*However, there was one region in its territory that wasn't clean and well formatted like the rest. That was the mighty `define_Conf` macro. The monster would have cleaned it up a long time ago but, the previous ruler of this kingdom a powerful Python script was prohibiting it. But now that the old king was slain in the great battle of rust-1.54.0, everything was possible again. Our lovely monster was now able to grab its cleaning equipment and get some nice formatting into the now unprotected area.*
*Said and done! Let this day go down in history!*
(I'll be the first to admit, that I'm a bit lost today. And I'm also procrastinating on some other discussions where I have some catching up to do... Oh, well, this was fun)
---
changelog: none
r? `@flip1995`
rfc3052 followup: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information for contributors, we may as well
remove it from crates in this repo.
Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default
This PR makes the `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint warn by default.
To avoid showing a large number of un-actionable warnings to users, we only enable the lint for macros defined in the same crate. This ensures that users will be able to fix the warning by simply removing a semicolon.
In the future, I'd like to enable this lint unconditionally, and eventually make it into a hard error in a future edition. This PR is a step towards that goal.
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
Updated config value name in change log for 1.54
Hey, I've noticed that the change log for 1.54 references the avoid_breaking_exported_api configuration with its Rust name, not the name it actually has in the config file. This should fix it for everyone, as the blog post references our change log on the master branch. Just a very small PR xD
changelog: none
(This is the change log xD)
r? `@flip1995`
Updated changelog for 1.55
This has again been a bit of work, but I'm happy to notice that my English is still improving, and I'm getting faster at these things. That's a very nice side effect of contributing and getting feedback on reviews 😊
Moving on, there were a few things that I was unsure about:
* The PR rust-lang/rust#86717 changes an old entry in the change log, is this worth mentioning? I've left it out for now.
* The stabilization of `cargo clippy --fix` is quite awesome and important IMO. It sadly gets a bit lost in the *Other* entry, as it's the last one. Do we maybe want to move it somewhere else or change the headline order for this release?
* I've listed the introduction of the new `suspicious` group under the *Moves and Deprecations* section. Is this alright, or should it be moved to the *Other* section as well?
* Last but definitely not least, some fun! I've used the 🎉 emoji in the `cargo clippy --fix` entry, is this okay?
Sorry for the bombardment of questions xD
---
The PR already includes the entries for the new metadata collection and website updates. These are not merged yet, but should probably be to make this correct. This might also require the commit hashes to be updated (Not sure on this, though). It would actually be super fitting to get this into this release as we also stabilize `--fix`. TODOs:
* [x] Merge metadata collection PRs:
1. #7279
2. #7298
3. #7420 (Hope to not get any merge conflicts)
---
[Rendered 📰](https://github.com/xFrednet/rust-clippy/blob/changelog-1-55/CHANGELOG.md)
r? `@flip1995`
changelog: none
Rename two lints to comply with our lint naming convention
self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain
We don't need to `register_renamed` those lints, since I'll backport them to beta, so the old names won't hit stable.
changelog: none
(I'll adapt the changelog before merging #7498)