Yoshitomo Nakanishi
9b0c1ebc18
Change to span_lint_and_sugg from span_lint_and_help
2021-02-16 18:07:09 +09:00
Yoshitomo Nakanishi
1f8ee3cc19
Handle struct ctor case
2021-02-16 11:20:51 +09:00
Camille GILLOT
dbe7609414
Only store a LocalDefId in hir::ImplItem.
2021-02-15 19:32:29 +01:00
Camille GILLOT
fc9bc33bba
Only store a LocalDefId in hir::TraitItem.
2021-02-15 19:32:28 +01:00
Camille GILLOT
2dc65397ee
Only store a LocalDefId in hir::Item.
...
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
Camille GILLOT
5b68fc16ed
Use ItemId as a strongly typed index.
2021-02-15 19:24:58 +01:00
Yoshitomo Nakanishi
fb91c76586
Add more tests for default_numeric_fallback
2021-02-15 23:33:27 +09:00
Yoshitomo Nakanishi
0198ac7bdd
Add fn_sig_opt to get fn signature from HirId
2021-02-15 23:29:18 +09:00
Yoshitomo Nakanishi
93796b2346
Add some restrictions to default_numeric_fallback to avoid FNs
2021-02-15 14:43:37 +09:00
bors
2f19f5f0d7
Auto merge of #6741 - ThibsG:BlockInIfConditions1141, r=flip1995
...
Do not lint when the closure is called using an iterator
Fix FP when the closure is used in an iterator for `blocks_in_if_conditions` lint
FIxes : #1141
changelog: none
2021-02-14 15:55:12 +00:00
ThibsG
12025506d6
Do not lint when the closure is called using an iterator
2021-02-14 16:21:12 +01:00
bors
9c3b43efdd
Auto merge of #6701 - camsteffen:collapsible-if, r=flip1995
...
Fix collapsible_if with attributes
changelog: Fix collapsible_if FP with attributes
Fixes #6593
2021-02-14 14:43:35 +00:00
bors
eb80ac4e72
Auto merge of #6697 - camsteffen:vec-init-push-fp, r=flip1995
...
Fix vec_init_then_push false positives
changelog: Fix vec_init_then_push false positives
Fixes #6615
2021-02-14 14:27:13 +00:00
bors
ce0a47ab8c
Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
...
directly expose copy and copy_nonoverlapping intrinsics
This effectively un-does https://github.com/rust-lang/rust/pull/57997 . That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163 .
Cc `@bjorn3` `@therealprof`
2021-02-13 20:30:07 +00:00
Mara Bos
dd91987533
Fix clippy's path to the copy intrinsics.
2021-02-13 18:58:54 +01:00
boolean_coercion
d36fe85569
Made parens addition smarter and added tests with bless
2021-02-13 00:33:08 +02:00
bors
047f3e16bf
Auto merge of #6700 - daxpedda:panics-doc-unreachable, r=llogiq
...
Fix missing_panics_doc warning on `unreachable!`.
Fixes #6699 .
Are there any other test-cases I should cover?
changelog: [`missing_panics_doc`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc ): No longer lints on [`unreachable!`](https://doc.rust-lang.org/std/macro.unreachable.html )
2021-02-12 20:48:05 +00:00
boolean_coercion
642efabfbb
Fixed typos and updated to matches! where applicable
2021-02-12 11:54:22 +02:00
boolean_coercion
9194c11d69
Fixed doctests that shouldn't have been compiled
2021-02-12 11:54:22 +02:00
boolean_coercion
d1a627ab3b
Ran bless and rustfmt
2021-02-12 11:54:22 +02:00
boolean_coercion
0b31b470ad
Changed applicability to MaybeIncorrect because of surrounding braces
2021-02-12 11:54:22 +02:00
boolean_coercion
a389c02461
from_str_radix_10 should be done
2021-02-12 11:54:22 +02:00
boolean_coercion
64729390a1
Implemented majority of from_str_radix_10
2021-02-12 11:54:22 +02:00
boolean_coercion
b80ac2af9c
Added boilerplate
2021-02-12 11:54:22 +02:00
bors
605e9ba3d7
Auto merge of #6179 - flip1995:rewrite_use_self, r=phansch
...
Rework use_self impl based on ty::Ty comparison #3410 | Take 2
This builds on top of #5531
I already reviewed and approved the commits by `@montrivo.` So only the review of my commits should be necessary.
I would also appreciate your review `@montrivo,` since you are familiar with the challenges here.
Fixes #3410 and Fixes #4143 (same problem)
Fixes #2843
Fixes #3859
Fixes #4734 and fixes #6221
Fixes #4305
Fixes #5078 (even at expression level now 🎉 )
Fixes #3881 and Fixes #4887 (same problem)
Fixes #3909
Not yet: #4140 (test added)
All the credit for the fixes goes to `@montrivo.` I only refactored and copy and pasted his code.
changelog: rewrite [`use_self`] lint and fix multiple (8) FPs. One to go.
2021-02-12 06:09:07 +00:00
flip1995
8b9f4a0d34
Merge commit '70c0f90453701e7d6d9b99aaa1fc6a765937b736' into clippyup
2021-02-11 15:04:38 +01:00
flip1995
00f9981f5c
Merge remote-tracking branch 'upstream/master' into rustup
2021-02-11 14:36:52 +01:00
bors
beb49bad26
Auto merge of #6650 - daxpedda:cargo-common-metadata-publish, r=flip1995
...
Fix cargo_common_metadata warning on `publish = false`.
I believe `cargo_common_metadata` shouldn't trigger when `publish = false`, not sure if everybody agrees.
Made some tests to handle all edge-cases.
Fixes #6649 .
changelog: [`cargo_common_metadata`](https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata ): No longer lints if [`publish = false`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field ) is defined in the manifest
2021-02-11 09:34:44 +00:00
bors
3784cdf98e
Auto merge of #6657 - ThibsG:FromIterParens, r=llogiq
...
Fix suggestions that need parens in `from_iter_instead_of_collect` lint
Fixes broken suggestions that need parens (i.e.: range)
Fixes : #6648
changelog: none
2021-02-10 19:37:27 +00:00
alpaca-tc
94b8f23baf
Fix typo
2021-02-11 00:45:28 +09:00
bors
b5e4389f53
Auto merge of #6695 - TaKO8Ki:add-bytes-nth, r=phansch
...
New lint: `bytes_nth`
This pull request adds a new lint named `bytes_nth`.
---
closes: https://github.com/rust-lang/rust-clippy/issues/6391
changelog: Added a new lint: `bytes_nth`
2021-02-10 13:54:33 +00:00
Cameron Steffen
52f98d832d
Use TyS::same_type
2021-02-10 11:58:21 +01:00
Cameron Steffen
7f61ddd5b8
Move "types to lint" to the item stack
2021-02-10 11:58:20 +01:00
Cameron Steffen
7e1c1c1541
Fix qpath_res call
2021-02-10 11:58:20 +01:00
flip1995
da65d8166f
Don't trigger use_self in macros
2021-02-10 11:57:28 +01:00
flip1995
ae2dd671f5
Rewrite use_self lint one more time
...
This rewrite gets rid of complicated visitors, by using the lint infrastructure as much as possible
2021-02-10 11:57:28 +01:00
Tim Nielens
fc334fb8f4
use_self - fix issue with hir_ty_to_ty
2021-02-10 11:57:28 +01:00
Tim Nielens
347b01eb1f
rework use_self impl based on ty::Ty comparison
2021-02-10 11:57:27 +01:00
Takayuki Maeda
932cc085e6
Update clippy_lints/src/methods/bytes_nth.rs
...
Co-authored-by: Phil Hansch <dev@phansch.net>
2021-02-10 15:49:07 +09:00
ThibsG
b932587c5d
Add better turbofish extractor
2021-02-09 17:43:49 +01:00
Ömer Sinan Ağacan
34b373d309
Rename HIR UnOp variants
...
This renames the variants in HIR UnOp from
enum UnOp {
UnDeref,
UnNot,
UnNeg,
}
to
enum UnOp {
Deref,
Not,
Neg,
}
Motivations:
- This is more consistent with the rest of the code base where most enum
variants don't have a prefix.
- These variants are never used without the `UnOp` prefix so the extra
`Un` prefix doesn't help with readability. E.g. we don't have any
`UnDeref`s in the code, we only have `UnOp::UnDeref`.
- MIR `UnOp` type variants don't have a prefix so this is more
consistent with MIR types.
- "un" prefix reads like "inverse" or "reverse", so as a beginner in
rustc code base when I see "UnDeref" what comes to my mind is
something like "&*" instead of just "*".
2021-02-09 11:39:20 +03:00
Cameron Steffen
39ba449c2a
Fix collapsible_if false positive with attributes
2021-02-08 11:00:30 -06:00
Cameron Steffen
1021327781
Simplify if_chain
2021-02-08 10:51:40 -06:00
daxpedda
6c73f989e2
Fix missing_panics_doc warning on unreachable!
.
2021-02-08 17:25:10 +01:00
Cameron Steffen
37555f8f73
Use path_to_local_id
2021-02-08 09:50:13 -06:00
Cameron Steffen
5db48a382a
Refactor out UnusedSelfVisitor
2021-02-08 08:56:33 -06:00
Cameron Steffen
1d30422945
Enhance LocalUsedVisitor to check closure bodies
2021-02-08 08:56:33 -06:00
Cameron Steffen
a42be8589a
Fix vec_init_then_push FP
2021-02-08 08:54:04 -06:00
Cameron Steffen
c44eafdcd7
Use id instead of name
2021-02-08 08:54:04 -06:00
David Tolnay
fd35517bd4
Downgrade trivial_regex to nursery
2021-02-07 16:54:09 -08:00