bors [Tue, 1 Jun 2021 00:47:05 +0000 (00:47 +0000)]
Auto merge of #7265 - Jarcho:manual_str_repeat, r=giraffate
Add lint `manual_str_repeat`
fixes: #7260
There's a similar function for slices. Should this be renamed to include it, or should that be a separate lint? If we are going to have them as one lint a better name will be needed. `manual_repeat` isn't exactly clear as it's replacing a call to `iter::repeat`.
bors [Thu, 27 May 2021 17:19:39 +0000 (17:19 +0000)]
Auto merge of #7285 - camsteffen:mini-macro-move, r=flip1995
Move mini-macro to tests/ui/auxilary
changelog: none
Merges `/mini-macro` into `/tests/ui/auxilary/proc_macro_derive.rs`.
The mini-macro crate is an artifact of the distant past. A lot has changed (#2284) and it doesn't make sense as a top-level crate anymore. Especially since we can use the auxilary folder to accompolish the same thing.
bors [Thu, 27 May 2021 04:49:56 +0000 (04:49 +0000)]
Auto merge of #7187 - camsteffen:avoid-break-exported, r=flip1995,phansch
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.
bors [Tue, 25 May 2021 14:08:02 +0000 (14:08 +0000)]
Auto merge of #7256 - xFrednet:7172-trick-cargos-caching-for-collection, r=flip1995
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
bors [Tue, 25 May 2021 13:53:37 +0000 (13:53 +0000)]
Auto merge of #7268 - mbartlett21:update_semi, r=Manishearth
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.
bors [Mon, 24 May 2021 16:18:19 +0000 (16:18 +0000)]
Auto merge of #7267 - camsteffen:sphash-improvements, r=Manishearth
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.
bors [Mon, 24 May 2021 00:20:17 +0000 (00:20 +0000)]
Auto merge of #7255 - whatisaphone:feat/similar-names-wparam-lparam, r=giraffate
Allow wparam and lparam in similar_names
`wparam` and `lparam` are often used as generic parameter names in win32 (for example [WindowProc](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms633573(v=vs.85))). This PR adds them to the similar_names exception list.
changelog: [`similar_names`] don't treat wparam and lparam as similar
bors [Fri, 21 May 2021 14:53:04 +0000 (14:53 +0000)]
Auto merge of #7105 - Jarcho:needless_borrow_pat, r=camsteffen
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`
Jason Newcomb [Sun, 18 Apr 2021 00:35:39 +0000 (20:35 -0400)]
Improve `needless_borrow` lint
Suggest changing usages of ref bindings to match the new type
Split out some cases into new lint `ref_binding_to_reference`
bors [Thu, 20 May 2021 12:32:06 +0000 (12:32 +0000)]
Auto merge of #7253 - flip1995:shrink-monster, r=xFrednet
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.
flip1995 [Thu, 20 May 2021 11:57:52 +0000 (13:57 +0200)]
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.
bors [Thu, 20 May 2021 10:07:36 +0000 (10:07 +0000)]
Auto merge of #7252 - flip1995:rustup, r=flip1995
Rustup
r? `@ghost`
cc `@xFrednet` There was a change to the `rustc_span::FileName` removing the `Display` impl for it. I adapted the metadata collector to compile with that change. I'm not sure if I changed the behavior with this. The path to the string is now printed relative to the `clippy_lints` dir. So for example `src/swap.rs`. I think this should be fine, but probably something to be aware of.
bors [Wed, 19 May 2021 15:23:58 +0000 (15:23 +0000)]
Auto merge of #7246 - xFrednet:7172-add-lint-level-to-output, r=flip1995
Adding the default lint level to the metadata collection
I noticed while working on the website adaption that the lint groups still had the `clippy::` prefix in the JSON output. This PR removes this prefix and adds a `level` field to each lint and with that simplifies the website display and saves performance.
The deprecated lints get are assigned to the level `none`. This is a bit different in comparison to the current lint list, but I believe that this will look better overall. Unless there is any argument against this :).
That's it just a small baby PR in comparison to the original monster ^^
---
See: #7172 for the full metadata collection to-do list or to suggest a new feature in connection to it.
bors [Tue, 18 May 2021 20:50:01 +0000 (20:50 +0000)]
Auto merge of #84767 - scottmcm:try_trait_actual, r=lcnr
Implement the new desugaring from `try_trait_v2`
~~Currently blocked on https://github.com/rust-lang/rust/issues/84782, which has a PR in https://github.com/rust-lang/rust/pull/84811~~ Rebased atop that fix.
Unfortunately this is already touching a ton of things, so if you have suggestions for good ways to split it up, I'd be happy to hear them. (The combination between the use in the library, the compiler changes, the corresponding diagnostic differences, even MIR tests mean that I don't really have a great plan for it other than trying to have decently-readable commits.
r? `@ghost`
~~(This probably shouldn't go in during the last week before the fork anyway.)~~ Fork happened.
Jason Newcomb [Thu, 15 Apr 2021 16:20:43 +0000 (12:20 -0400)]
Improve `multiple_inherent_impl` lint
Treat different generic arguments as different types.
Allow the lint to be ignored on the type definition, or any impl blocks.
In addition it forwards the `deny-warnings` feature to those sub-crates, so we don't miss warnings that then become a problem during sync. (I wanted to fix that before, but forgot about it, so thanks for pointing it out `@xFrednet!)`
flip1995 [Tue, 18 May 2021 09:01:00 +0000 (11:01 +0200)]
Deny warning in every main sub-crate
This enables the same warnings that are enabled in `clippy_lints` also
in `clippy_utils` and `clippy_dev`. Then it makes sure, that the
`deny-warnings` feature is passed down to `clippy_lints` and
`clippy_utils` when compiling Clippy.
bors [Tue, 18 May 2021 08:24:04 +0000 (08:24 +0000)]
Auto merge of #7240 - flip1995:rollup-6nwjgyp, r=flip1995
Rollup of 3 pull requests
Successful merges:
- #7235 (Fix another manual_unwrap_or deref FP)
- #7237 (Add the command to add upstream remote)
- #7239 (CI: update rustup before installing the toolchain on windows)