Don't lint on `Result` and `Option` types.
Considers `or` patterns.
Considers variants prefixed with `Self`
Suggestions will try to find a common prefix rather than just using the full path
Don't re-export `clippy_utils::*`
changelog: none
This should wrap up the utils-related really big changes. I personally don't see any more sub-modules to be added to `clippy_utils`.
Write literal suggestion
fixes: #6768
changelog: Add suggestion to `write_literal` and `print_literal` lints
changelog: Change `use_debug` to point only at the format string
docs: update RA setup documentation
Add documentation how to get rust-analyzer to like clippys `extern crate` rustc deps.
Fixes#6883
This initially removed `cargo-dev ra_setup` but it is still needed by folks who use intellij rust, so keeping that.
changelog: none
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`