Fix missing_docs_in_private_items false negative
changelog: Fix [`missing_docs_in_private_items`] false negative when the item has any `#[name = "value"]` attribute
Closes#7247 (decided not to use the rustc method since it calls `Session::check_name`, which is for rustc only)
Fix allow on some statement lints
changelog: Fix `#[allow(..)]` over statements for [`needless_collect`], [`short_circuit_statement`] and [`unnecessary_operation`]
Fixes#7171Fixes#7202
Add avoid_breaking_exported_api config option
changelog: Add `avoid_breaking_exported_api` config option for [`enum_variant_names`], [`large_types_passed_by_value`], [`trivially_copy_pass_by_ref`], [`unnecessary_wraps`], [`upper_case_acronyms`] and [`wrong_self_convention`].
changelog: Deprecates [`pub_enum_variant_names`] and [`wrong_pub_self_convention`] as the non-pub variants are now configurable.
changelog: Fix various false negatives for `pub` items that are not exported from the crate.
A couple changes to late passes in order to use `cx.access_levels.is_exported` rather than `item.vis.kind.is_pub`.
I'm not sure how to better document the config option or lints that are (not) affected (see comments in #6806). Suggestions are welcome. cc `@rust-lang/clippy`
I added `/clippy.toml` to use the config internally and `/tests/clippy.toml` to maintain a default config in ui tests.
Closes#6806Closes#4504
Adding the ability to invalidate caches to force metadata collection
This adds the discussed hack to touch `clippy_lints/src/lib.rs` to invalidate cargos cache and force metadata collection. I've decided to use the [`filetime`](https://github.com/alexcrichton/filetime) crate instead of the touch command to make is cross-platform and just cleaner in general. Looking at the maintainers I would say that it's a save crate to use xD.
---
cc: #7172 I know this ID without looking it up now... This is not good
changelog: none
r? `@flip1995`
Move `semicolon_if_nothing_returned` to `pedantic`
This moves the `semicolon_if_nothing_returned` lint to `pedantic` category.
I had done #7148, but on the master branch, and Github doesn't seem to let me change that, so here's another PR
changelog: Move [`semicolon_if_nothing_returned`] lint into `pedantic` category.
Some SpanlessHash improvements
changelog: none
* Use `mem::discriminant().hash()` instead of `stable_hash` for simple enums and then use `FxHasher` instead of `StableHasher`. We don't use any StableHash features.
* Use `UnHashMap` for maps keyed by spanless hash values.
Fix invalid syntax in `from_iter_instead_of_collect` suggestion
First attempt at contributing, hopefully this is a good start and can be improved. :)
fixes#7259
changelog: [`from_iter_instead_of_collect`] fix invalid suggestion involving "as Trait"
Fix `redundant_closure` for `vec![]` macro in a closure with arguments
fixes: #7224
changelog: Fix `redundant_closure` for `vec![]` macro in a closure with arguments
Move `needless_borrow` to style
fixes: #3742#7105 should be merged first to fix the false positive.
changelog: move `needless_borrow` from `nursery` to `style`
fix `needless_borrow` suggestion
fixes: #2610
While I'm working on this, should needless_borrow be split into two? One lint for expressions and another for patterns. In expression it only lints when the compiler inserts a dereference, but for patterns it's whenever a double reference is created. I think at least the case where a double reference is needed should be split into a new lint as it's not 'needless', it can just be done without a ref binding.
For illustration:
```rust
fn foo(x: &&str) {}
match Some("test") {
// ref binding is useless here
Some(ref x) => *x,
_ => (),
}
match Some("test") {
// ref binding is useless here
Some(ref x) => x.len(),
_ => (),
}
match Some("test") {
// double reference is needed, but could be `Some(x) => foo(&x)`
Some(ref x) => foo(x),
_ => (),
}
```
changelog: Improve the suggestion for `needless_borrow` in patterns to change all usage sites as needed.
changelog: Add lint `ref_binding_to_reference`