Commit graph

6066 commits

Author SHA1 Message Date
bors
d1308aecaf Auto merge of #7292 - Jarcho:suspicious_splitn, r=flip1995
Add lint `suspicious_splitn`

fixes: #7245
changelog: Add lint `suspicious_splitn`
2021-05-30 20:32:22 +00:00
Jason Newcomb
5fa08eaf53
Evaluate constant expressions in suspicious_splitn 2021-05-30 13:25:24 -04:00
Jason Newcomb
898b6a0e07
Add lint suspicious_splitn 2021-05-30 09:49:55 -04:00
Jason Newcomb
4ba6afd192
Fix ICE in too_many_lines due to wrong assumptions on braces. 2021-05-27 22:44:08 -04:00
Cameron Steffen
d39a11cbe1 Remove clippy_utils::consts re-export 2021-05-27 08:52:10 -05:00
bors
2fa9362448 Auto merge of #7281 - camsteffen:has-doc-fp, r=flip1995
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)
2021-05-27 08:37:08 +00:00
bors
8066f836ec Auto merge of #7282 - camsteffen:lint-stmt-expr, r=flip1995
Fix allow on some statement lints

changelog: Fix `#[allow(..)]` over statements for [`needless_collect`], [`short_circuit_statement`] and [`unnecessary_operation`]

Fixes #7171
Fixes #7202
2021-05-27 08:23:21 +00:00
bors
9c4651f2ee 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.

Closes #6806
Closes #4504
2021-05-27 04:49:56 +00:00
Cameron Steffen
f3e77a454a Fix allow on some statement lints 2021-05-26 22:07:53 -05:00
Cameron Steffen
6eea598645 Fix config file lookup 2021-05-26 21:53:43 -05:00
bors
f205dd176a Auto merge of #7280 - camsteffen:macro-use, r=Manishearth
Add macro_use clippy_utils

changelog: none
2021-05-26 22:15:07 +00: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
mbartlett21
bcebea65c1 Run cargo fmt 2021-05-25 06:05:52 +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
Cameron Steffen
24743b3968 Use UnhashMap 2021-05-24 09:48:05 -05: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
Jason Newcomb
f355aebf10
Move needless_borrow to style 2021-05-21 11:24:52 -04: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
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
451ff5668b
Merge remote-tracking branch 'upstream/master' into rustup 2021-05-20 12:05:02 +02:00
Fridtjof Stoldt
9dc366bc4d
Fixed a type
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-05-19 17:23:33 +02:00
xFrednet
8036d7f784 Adding the default lint level to the metadata collection
And stripping the clippy:: prefix from the group
2021-05-19 16:42:21 +02:00
bors
4f3b49fffa 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.

`try_trait_v2` tracking issue: https://github.com/rust-lang/rust/issues/84277

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.
2021-05-18 20:50:01 +00:00
bors
aa1959b90c Auto merge of #7089 - Jarcho:multiple_impls_generic, r=Jarcho
Don't lint `multiple_inherent_impl` with generic arguments

fixes: #5772
changelog: Treat different generic arguments as different types in `multiple_inherent_impl`
2021-05-18 16:35:48 +00:00
Jason Newcomb
760f70312e
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.
2021-05-18 11:45:51 -04:00
Jason Newcomb
a149ba26fa
Fix ICE in implicit_return
async functions always return a value
2021-05-18 10:51:59 -04:00
flip1995
ff452d5ba6
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.
2021-05-18 11:05:48 +02:00
Philipp Krones
99fb776ace
Rollup merge of #7235 - camsteffen:manual-unwrap-or-deref, r=flip1995
Fix another manual_unwrap_or deref FP

changelog: none (since this just piggybacks on #7233)

Fixes #6960
2021-05-18 10:21:55 +02:00
bors
9028173b24 Auto merge of #7201 - mucinoab:master, r=giraffate
Remove powi, "square can be computed more efficiently"

powi(2) produces exactly the same native code as x * x
powi was part of the [`suboptimal_flops`] lint

fixes #7058
changelog: Remove powi [`suboptimal_flops`], "square can be computed more efficiently"
2021-05-18 05:28:42 +00:00
Bruno A. Muciño
be540e6596 Remove powi, "square can be computed more efficiently"
powi(2) produces exactly the same native code as x * x
2021-05-17 21:59:08 -05:00
bors
6fcdb8a297 Auto merge of #7234 - camsteffen:if-let-else-braces, r=flip1995
Remove dead code after #7216

changelog: none
2021-05-17 21:42:21 +00:00
Cameron Steffen
8356c485a9 Fix manual_unwrap_or FP deref reference 2021-05-17 14:20:26 -05:00