Commit Graph

1496 Commits

Author SHA1 Message Date
flip1995
9c1dd0c227
Fix remaining dogfood errors (internal lints) 2021-03-11 10:57:49 +01:00
flip1995
78c740e2f3
Merge remote-tracking branch 'upstream/master' into rustup 2021-03-11 10:37:58 +01:00
bors
36a27ecaac Auto merge of #79519 - cjgillot:noattr, r=wesleywiser
Store HIR attributes in a side table

Same idea as #72015 but for attributes.
The objective is to reduce incr-comp invalidations due to modified attributes.
Notably, those due to modified doc comments.

Implementation:
- collect attributes during AST->HIR lowering, in `LocalDefId -> ItemLocalId -> &[Attributes]` nested tables;
- access the attributes through a `hir_owner_attrs` query;
- local refactorings to use this access;
- remove `attrs` from HIR data structures one-by-one.

Change in behaviour:
- the HIR visitor traverses all attributes at once instead of parent-by-parent;
- attribute arrays are sometimes duplicated: for statements and variant constructors;
- as a consequence, attributes are marked as used after unused-attribute lint emission to avoid duplicate lints.

~~Current bug: the lint level is not correctly applied in `std::backtrace_rs`, triggering an unused attribute warning on `#![no_std]`. I welcome suggestions.~~
2021-03-10 08:40:51 +00:00
Camille GILLOT
b32cffe493 Remove hir::Crate::attrs. 2021-03-09 19:22:55 +01:00
kadmin
cb8bc0b6e6 Switch to changing cp_non_overlap in tform
It was suggested to lower this in MIR instead of ssa, so do that instead.
2021-03-09 16:54:14 +00:00
kadmin
fb4dc5845b Update cranelift 2021-03-09 16:54:14 +00:00
kadmin
6f60dd884e Update match branches
This updates all places where match branches check on StatementKind or UseContext.
This doesn't properly implement them, but adds TODOs where they are, and also adds some best
guesses to what they should be in some cases.
2021-03-09 16:54:13 +00:00
bors
8a5f98a0e4 Auto merge of #6866 - anall:ice6840, r=flip1995
Fix ICE 6840 - make is_normalizable more strict

fixes #6840

make `is_normalizable` more strict, which should catch this ICE and related cases

changelog: Fix ICE in [`zero_sized_map_values`]
2021-03-09 14:58:24 +00:00
Andrea Nall
9707599714 add comment for when can be removed 2021-03-09 08:30:33 -06:00
bors
627e910fe5 Auto merge of #6868 - Jarcho:lang_item, r=flip1995
Don't assume lang items will exist.

~~Should fix lintcheck warnings caused by #6823~~
See below

changelog: None
2021-03-09 14:28:49 +00:00
bors
3ed0bccb70 Auto merge of #6873 - Y-Nak:refactor-casts-lint, r=flip1995
Refactor casts lint

Ref: #6724

Changes:
1. Separate the `casts` group from the `types` group.
2. Reorganize the lints of the `casts` group into their own modules.

Notes:
1. I didn't `fix` #6874 in order to maintain this PR as small as possible.

---
changelog: none
2021-03-09 12:43:20 +00:00
Andrea Nall
e812a8abde use .all instead of negative use of .any 2021-03-08 23:08:52 -06:00
Andrea Nall
e322c773e3 use TyS::walk 2021-03-08 23:03:45 -06:00
Yoshitomo Nakanishi
360f065404 Move 'is_isize_or_usize' to clippy_utils 2021-03-09 11:08:45 +09:00
Daniel McNab
c4e2cf9601 Opt-in to rustc_private for rust-analyzer
rust-analyzer/rust-analyzer#7891
2021-03-08 17:39:51 +00:00
Jason Newcomb
f2d917e3b1
Don't assume lang items will exist. 2021-03-08 11:08:52 -05:00
Andrea Nall
b27cbda32b make is_normalizable more strict 2021-03-07 21:45:54 -06:00
Andrea Nall
9bdc273f03 relocate functions from clippy_lints::types
relocate `is_ty_param_lang_item` and `is_ty_param_diagnostic_item` to `clippy_utils`
2021-03-07 17:58:39 -06:00
Andrea Nall
3877a410be migrate paths to newly-added diagnostic items
This gets rid of the following paths:
  * OS_STRING
  * TO_OWNED
  * TO_STRING

Also removes some usages of:
  * PATH_BUF

And the now completely unused `clippy_lints::types::is_ty_param_path`
2021-03-07 17:53:12 -06:00
Jason Newcomb
47145dec36
len_without_is_empty will now consider multiple impl blocks
`len_without_is_empty` will now consider `#[allow]` on both the `len` method, and the type definition
2021-03-07 09:40:18 -05:00
bors
5945e85f34 Auto merge of #6823 - Jarcho:diagnostic_items, r=phansch
Use diagnostic or language items instead of paths

I think that gets everything except ones used in a list of paths to check.

changelog: none
2021-03-07 12:04:42 +00:00
Oli Scherer
5b2e7e91c3 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
Jason Newcomb
39c5e86337
When checking if two empty hir blocks are equal also check to see if the tokens used are the same as well 2021-03-04 11:06:24 -05:00
bors
ece3543c9f Auto merge of #6801 - Jarcho:manual_match_fix, r=phansch
Fix `manual_map` false positives

fixes: #6795
fixes: #6797
fixes: #6811
fixes: #6819

changelog: Fix false positives for `manual_map` when `return`, `break`, `continue`, `yield`, `await`, and partially moved values are used.
changelog: Don't expand macros in suggestions  for `manual_map`
2021-03-02 15:36:00 +00:00
Jason Newcomb
f21320fd74
Use diagnostic or language items instead of paths 2021-03-01 23:10:51 -05:00
Cameron Steffen
ada8c72f3f Add version = "Two" to rustfmt.toml
Ignore UI tests since this change makes rustfmt less friendly with UI
test comments.
2021-03-01 16:17:33 -06:00
Cameron Steffen
7984e60d9e Use diagnostic items in into_iter_collections 2021-03-01 09:04:11 -06:00
Jason Newcomb
a3278a16d3
Fix manual_map: do not expand macros in suggestions 2021-02-28 09:13:24 -05:00
Cameron Steffen
2b3a731e1c Add missing diagnostic item Symbols 2021-02-26 22:12:36 -06:00
Andrea Nall
3d3cfd3754 added new lint implicit_clone 2021-02-26 19:13:47 -06:00
Jason Newcomb
ef87e58993
Fix manual_map: don't lint when partially moved values are used.
Fix `manual_map`: don't lint when `return`, `break`, and `continue` are used.
2021-02-26 16:24:25 -05:00
flip1995
f64149dd04 Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup 2021-02-25 11:25:22 +01:00
flip1995
c6408a47bd
Merge remote-tracking branch 'upstream/master' into rustup 2021-02-25 10:40:00 +01:00
Samuel E. Moelius III
8047458f40 Move conf.rs back into clippy_lints 2021-02-24 06:21:46 -05:00
Samuel E. Moelius III
ab7381f085 Move declare_clippy_lint back into clippy_lints 2021-02-23 18:50:30 -05:00
Samuel E. Moelius
33ee598a9f Update clippy_utils/Cargo.toml
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
50e3ef9eb5 Remove file accidentally re-added during rebase 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
979206f6b4 Fix doc test 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
964f2a0ef2 Bump clippy_utils version 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
5f04b50191 Fix one import 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
ff157ae1f4 Improve tests 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
b7f03c6697 Remove unused features 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
29b6570612 Remove unused dependencies 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
523de296cc Get tests to pass 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
c5b9d22b02 Update clippy_utils/src/lib.rs 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
09bded4437 Factor out clippy_utils crate 2021-02-23 18:50:30 -05:00