Commit graph

11846 commits

Author SHA1 Message Date
Cameron Steffen
7dd356d9f1 Eat dogfood 2021-05-26 16:53:13 -05:00
Cameron Steffen
c51472b4b0 Add clippy.toml to project and tests 2021-05-26 16:53:13 -05:00
Cameron Steffen
55ccc7a8c6 Use break api config for upper_case_acronyms 2021-05-26 16:53:13 -05:00
Cameron Steffen
1ce581d706 Use break api config for unnecessary_wraps 2021-05-26 16:53:13 -05:00
Cameron Steffen
3d77a2b861 Use break api config for enum_variant_names 2021-05-26 16:53:13 -05:00
Cameron Steffen
ee79077d80 Use break api config for pass by value or ref 2021-05-26 16:53:13 -05:00
Cameron Steffen
d7f47f280e Use break api config for wrong_pub_self_convention 2021-05-26 16:53:13 -05:00
Cameron Steffen
2e2021bbda Add avoid_breaking_exported_api config option 2021-05-26 16:35:22 -05:00
Cameron Steffen
c21b965d43 Fix missing_docs_in_private_items FP 2021-05-26 16:25:38 -05:00
Cameron Steffen
5cc6635fcf Add macro_use clippy_utils 2021-05-26 16:11:18 -05:00
bors
6d50cff45a 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

changelog: none

r? `@flip1995`
2021-05-25 14:08:02 +00:00
bors
cd4abf93e0 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.
2021-05-25 13:53:37 +00:00
mbartlett21
bcebea65c1 Run cargo fmt 2021-05-25 06:05:52 +00:00
mbartlett21
0c017ea058 Remove semicolons in clippy_utils 2021-05-25 02:12:27 +00:00
mbartlett21
9cad27fce8 Add semicolon in needless_for_each.rs 2021-05-25 02:06:45 +00:00
mbartlett21
6d73777224 Fix same_item_push.rs 2021-05-25 02:03:31 +00:00
mbartlett21
527fb42a32 Add all the semicolons to clippy_lints 2021-05-25 01:46:33 +00:00
mbartlett21
cadad20da1 Add semicolons up to needless_for_each.rs 2021-05-25 00:54:50 +00:00
mbartlett21
1ac7e19b4c Move semicolon_if_nothing_returned to pedantic 2021-05-24 22:09:07 +00:00
bors
a248648862 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.
2021-05-24 16:18:19 +00:00
Cameron Steffen
7f340578cc Hash Symbol directly 2021-05-24 10:51:40 -05:00
Cameron Steffen
9d61b4e081 Fix SpanlessEq for GenericArg::Const 2021-05-24 10:51:40 -05:00
Pietro Albini
91aa821745 remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
Cameron Steffen
0ebd5018bf Add a short-circuiting case 2021-05-24 09:48:05 -05:00
Cameron Steffen
24743b3968 Use UnhashMap 2021-05-24 09:48:05 -05:00
Cameron Steffen
f21d909e62 Use FxHasher 2021-05-24 09:31:11 -05:00
Cameron Steffen
27ac647649 Use discriminant instead of stable_hash 2021-05-24 09:31:09 -05:00
Cameron Steffen
e027b6bc49 Minor SpanlessHash improvements 2021-05-24 09:30:52 -05:00
bors
c25f4b4434 Auto merge of #7266 - mikerite:20210524_sus_nursery, r=giraffate
Downgrade suspicious_op..._groupings to Nursery

This addresses #6722.

changelog: Downgrade [`suspicious_lint_operations`] to Nursery
2021-05-24 13:38:19 +00:00
Michael Wright
2f78d57d8b Downgrade suspicious_op..._groupings to Nursery
This addresses #6722.
2021-05-24 06:44:38 +02:00
bors
41bb092185 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
2021-05-24 00:20:17 +00:00
bors
297e7433bf Auto merge of #7264 - yotamofek:from_iter_instead_collect_as_trait, r=llogiq
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"
2021-05-22 23:08:51 +00:00
bors
87871864b3 Auto merge of #7263 - Jarcho:redundant_closure_macro, r=llogiq
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
2021-05-22 21:41:08 +00:00
Yotam Ofek
ae0d4da764 Fix invalid syntax in from_iter_instead_of_collect suggestion with "as Trait" 2021-05-22 21:47:11 +03:00
Jason Newcomb
60dd2b65dc
Fix redundant_closure for vec![] macro in a closure with arguments 2021-05-21 15:48:29 -04:00
bors
f694f85ab3 Auto merge of #7254 - Jarcho:needless_borrow_2, r=Manishearth
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`
2021-05-21 17:56:43 +00:00
Jason Newcomb
7db0e4f791
Suggest &mut iter inside a closure for while_let_on_iterator 2021-05-21 12:27:40 -04:00
Jason Newcomb
f355aebf10
Move needless_borrow to style 2021-05-21 11:24:52 -04:00
bors
029c326058 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`
2021-05-21 14:53:04 +00:00
bors
853f59354d Auto merge of #7258 - YohDeadfall:update-copyrights, r=Manishearth
Updated years in copyrigths

This PR just updates years in copyrights, nothing more.

changelog: none
2021-05-21 00:37:00 +00:00
Yoh Deadfall
31b97ea3b2 Updated years in copyrigths 2021-05-20 23:09:27 +02:00
xFrednet
e3a1ae7bfe Adding the ability to invalidate caches to force metadata collection 2021-05-20 22:30:49 +02:00
John Simon
2eafec182d Allow wparam and lparam in similar_names 2021-05-20 10:20:14 -04:00
Jason Newcomb
6d4dc35882
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`
2021-05-20 09:03:47 -04:00
Jason Newcomb
6e03a306ac
Remove fix for rustc bug from needless_borrow
The spans given for derived traits used to not indicate they were from a macro expansion.
2021-05-20 09:03:31 -04:00
bors
60826e77c3 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.

cc #7172

r? `@xFrednet`

changelog: none
2021-05-20 12:32:06 +00:00
flip1995
7304829115
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.
2021-05-20 13:57:52 +02:00
flip1995
97705b7ea6 Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup 2021-05-20 13:07:57 +02:00
bors
9e3cd88718 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.

changelog: none
2021-05-20 10:07:36 +00:00
flip1995
559ce6d772
Bump nightly version -> 2021-05-20 2021-05-20 12:06:22 +02:00