StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")
Also rename visiting and other methods working on them.
Do not show docs link when lint doesn't start with "clippy::"
This small change ensures that if the diagnostic functions are called from outside of Clippy, a docs link is not displayed.
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: restrict docs links
Refactor unit types
Ref: #6724
r? `@flip1995`
Changes:
1. Extract `unit_types` from `types` group.
2. Move lints of `unit_types` to their own modules.
Notes:
Other lints of `unit_types` is still scattered around the `clippy_lints`, e.g. `result_unit_err` or `option_map_unit_fn`.
These should be addressed in another PR.
changelog: none
wrong_self_convention: fix lint in case of `to_*_mut` method
fixes#6758
changelog: wrong_self_convention: fix lint in case of `to_*_mut` method. When a method starts with `to_` and ends with `_mut`, clippy expects a `&mut self` parameter, otherwise `&self`.
Any feedback is welcome. I was also thinking if shouldn't we treat `to_` the same way as `as_`. Namely to accept `self` taken: `&self` or `&mut self`.
Move some utils to `clippy_utils::ty`
changelog: none
`clippy_utils::*` has become a giant junk drawer. This is one step to clean it up a bit. One motivation is that I believe the long import statements cause more merge conflicts.
replace span_lint with span_lint_and_sugg along with error message
fixes: #6874
changelog: none
apologies if this may not be the most idiomatic way of doing it, any advice on changes (if any) would be greatly appreciated.
mem_replace_with_default: recognize some std library ctors
fixes#6562
changelog: mem_replace_with_default: recognize some common constructors equivalent to `Default::default()`
Fix suggestion for `explicit_deref_methods`. Sometimes `&**` is needed, sometimes nothing is needed.
Allow `explicit_deref_methods` to trigger in a few new contexts.
`explicit_deref_methods` will now consider ufcs calls
inconsistent_struct_constructor: try to make message and lint description a bit clearer
changelog: inconsistent_struct_constructor: try to make message and lint description a bit clearer
r? `@ghost`
Use sym::Iterator instead of paths::ITERATOR
Since `sym::Iterator` was added to diagnostic_item, it's time to remove `paths::ITERATOR`.
ref: #5393
changelog: Add `is_trait_method` to `clippy_utils`
changelog: Remove `paths::ITERATOR`
Refactor: arrange lints in `methods` module
This PR arranges methods lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in #6680.
changelog: Move lints in methods module into their own modules.
move lintcheck into its own crate
This pr:
* moves lintcheck out of `clippy dev` and into its own crate (`lintcheck`) (I should have done this earlier :D)
* makes lintcheck terminate if it is not launched from the repo root (to prevent problems with wrong paths when using `cargo run` in the crate root)
* fixes json lint messages leaking the runners `$HOME` when a lint messages comes from a proc macro that originates from a crate inside the `$CARGO_CACHE`
* adds more documentation to lintchecks `README.md` and mentions lintcheck in `docs/basics.md`
changelog: none