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`
Early return from LintPass registration when collecting metadata
This speeds up the metadata collection by 2-2.5x on my machine. During
metadata collection other lint passes don't have to be registered, only
the lints themselves.
cc #7172
r? `@xFrednet`
changelog: none
This speeds up the metadata collection by 2-2.5x on my machine. During
metadata collection other lint passes don't have to be registered, only
the lints themselves.