tests: add test that roughly ensures that our lint messages conform with the diagnostics convention of the rustc dev guide
lint message should not start with uppercase letters
lint messages should not have punctuation at the end of the last line
https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure
The test reads through all the .stderr files in the testsuit and checks lint messages that start with "help: ", "error: " etc.
There is also an exception list for special messages that are deemed acceptable.
changelog: make sure lint messages conform with the rustc dev guide and add test
lint message should not start with uppercase letters
lint messages should not have punctuation at the end of the last line
https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure
The test reads through all the .stderr files in the testsuit and checks lint messages that start with "help: ", "error: " etc.
There is also an exception list for special messages that are deemed acceptable.
changelog: make sure lint messages conform with the rustc dev guide and add test
Fix ICEs 6792 and 6793
fixes#6792, fixes#6793.
r? `@matthiaskrgr`
Fixes the ICEs by replacing `TyCtxt::type_of` with `TypeckResults::expr_ty`.
changelog: none
added new lint `owned_to_owned`
Adding new lint `owned_to_owned`
Creating draft PR to have this looked over.
I think this takes all advice I received into account.
I did have to update the `redundant_clone` test to ignore this lint -- I felt that was the safest action.
closes: #6715
changelog: added new lint `implicit_clone`
Downgrade manual_map to nursery
I believe #6795 should be considered a blocker for this lint to be considered for enabling by default.
---
changelog: remove manual_map from default list of enabled lints
In order to check if we need to recheck crates, I was getting the path from clap only
which is None if we don't pass it via cmdline args.
Use the dedicated lintcheck_config_toml() fnuction instead!
Fix false positive for unit_arg lint
Fixes#6447
To avoid false positives don't complain about unit args when they come from a path expression, e.g. a local variable.
**Note:** This is my first contribution to Clippy, so I might have messed up somewhere. Any feedback is welcome and I'm happy to work out any kinks.
---
changelog: Do not lint unit arguments when they come from a path expression.
or_fun_call: fix suggestion for `or_insert(vec![])`
fixes#6748
changelog: or_fun_call: fix suggestion for `or_insert(vec![])` on `std::collections::hash_map::Entry` or `std::collections::btree_map::Entry`
Applies for `std::collections::hash_map::Entry` and `std::collections::btree_map::Entry`
Example:
Previously, for the following code:
`let _ = hash_map.entry("test".to_owned()).or_insert(vec![]);`
clippy would suggest to use:
`or_insert_with(vec![])`, which causes a compiler error (E0277).
Now clippy suggests:
`or_insert_with(Vec::new)`
move upper_case_acronyms back to style, but make the default behaviour less aggressive by default (can be unleashed via config option)
Previous discussion in the bi-weekly clippy meeting for reference: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202021-02-23/near/227458019
Move the `upper_case_acronyms` lint back to the style group.
Only warn on fully-capitalized names by default.
Add add a clippy-config option `upper-case-acronyms-aggressive: true/false` to enabled more aggressive linting on
all substrings that could be capitalized acronyms.
---
changelog: reenable upper_case_acronyms by default but make the more aggressive linting opt-in via config option
Moves the lint back from pedantic to style group.
The lint default now only warns on names that are completely capitalized, like "WORD"
and only if the name is longer than 2 chars (so that names where each of the letter represents a word are still distinguishable).
For example: FP (false positive) would still be "valid" and not warned about (but EOF would warn).
A "upper_case_acronyms_aggressive: true/false" config option was added that restores the original lint behaviour to warn
on any kind of camel case name that had more than one capital letter following another capital letter.
Factor out `clippy_utils` crate
As discussed in https://github.com/rust-lang/rust-clippy/pull/6746, this PR factors out `clippy_lints::utils` as its own crate, `clippy_utils` .
This change will allow `clippy_utils` to be used in lints outside of Clippy.
There is no plan to publish this crate on `crates.io` (see https://github.com/rust-lang/rust-clippy/pull/6746#issuecomment-780747522). Dependent crates should obtain it from GitHub.
changelog: Factor out `clippy_utils` so it can be used by external tools (not published)
README: Add subsection on running Clippy as a rustc wrapper
This is useful for projects that do not use cargo.
changelog: README: Add subsection on running Clippy as a rustc wrapper