]>
git.lizzy.rs Git - rust.git/log
Cameron Steffen [Sun, 14 Mar 2021 23:17:44 +0000 (18:17 -0500)]
Move some utils to clippy_utils::source module
Cameron Steffen [Sat, 13 Mar 2021 23:01:03 +0000 (17:01 -0600)]
Move some utils to ty_utils
bors [Mon, 15 Mar 2021 15:56:56 +0000 (15:56 +0000)]
Auto merge of #6831 - camsteffen:suspicious-map, r=Y-Nak,flip1995
Fix suspicious_map false positives
changelog: Fix suspicious_map false positives
Fixes #5253
Replaces #5375
Cameron Steffen [Mon, 15 Mar 2021 13:51:23 +0000 (08:51 -0500)]
Improve `find_binding_init` docs
Ben Boeckel [Thu, 26 Mar 2020 01:13:24 +0000 (21:13 -0400)]
Fix suspicious_map false positives
bors [Sun, 14 Mar 2021 15:01:01 +0000 (15:01 +0000)]
Auto merge of #6895 - iobtl:reformat_unnecessary_cast, r=llogiq
replace span_lint with span_lint_and_sugg along with error message
fixes: #6874
changelog: none
apologies if this may not be the most idiomatic way of doing it, any advice on changes (if any) would be greatly appreciated.
iobtl [Sun, 14 Mar 2021 00:09:08 +0000 (08:09 +0800)]
use lint_unnecessary_cast for literals, suggest `_` if not present
bors [Sat, 13 Mar 2021 15:54:54 +0000 (15:54 +0000)]
Auto merge of #6859 - magurotuna:if_then_some_else_none, r=giraffate
Implement new lint: if_then_some_else_none
Resolves #6760
changelog: Added a new lint: `if_then_some_else_none`
bors [Sat, 13 Mar 2021 15:43:00 +0000 (15:43 +0000)]
Auto merge of #6820 - mgacek8:issue_6562_enhance_mem_replace_with_default_with_other_ctors, r=phansch
mem_replace_with_default: recognize some std library ctors
fixes #6562
changelog: mem_replace_with_default: recognize some common constructors equivalent to `Default::default()`
bors [Sat, 13 Mar 2021 15:31:14 +0000 (15:31 +0000)]
Auto merge of #6865 - Jarcho:explicit_deref_methods, r=llogiq
`explicit_deref_methods` improvements
Breaking up #6837
changelog: `explicit_deref_methods` will lint chained `deref` calls and ufcs style calls
Jason Newcomb [Sat, 13 Mar 2021 13:27:42 +0000 (08:27 -0500)]
Properly lint macro arguments for `explicit_deref_methods`
Jason Newcomb [Sat, 13 Mar 2021 01:13:45 +0000 (20:13 -0500)]
Keep track of whether `deref` or `deref_mut` was called
Remove more unnecessary code
Jason Newcomb [Tue, 9 Mar 2021 15:37:15 +0000 (10:37 -0500)]
Remove unneeded code.
Jason Newcomb [Tue, 2 Mar 2021 18:32:56 +0000 (13:32 -0500)]
Make `explicit_deref_methods` check for multiple deref calls
Fix suggestion for `explicit_deref_methods`. Sometimes `&**` is needed, sometimes nothing is needed.
Allow `explicit_deref_methods` to trigger in a few new contexts.
`explicit_deref_methods` will now consider ufcs calls
iobtl [Sat, 13 Mar 2021 08:54:59 +0000 (16:54 +0800)]
replace span_lint with span_lint_and_sugg along with error message
bors [Sat, 13 Mar 2021 04:52:40 +0000 (04:52 +0000)]
Auto merge of #6892 - matthiaskrgr:inc_struct_ctor, r=Y-Nak
inconsistent_struct_constructor: try to make message and lint description a bit clearer
changelog: inconsistent_struct_constructor: try to make message and lint description a bit clearer
r? `@ghost`
bors [Fri, 12 Mar 2021 22:36:49 +0000 (22:36 +0000)]
Auto merge of #6891 - Y-Nak:use-iterator-sym, r=Manishearth
Use sym::Iterator instead of paths::ITERATOR
Since `sym::Iterator` was added to diagnostic_item, it's time to remove `paths::ITERATOR`.
ref: #5393
changelog: Add `is_trait_method` to `clippy_utils`
changelog: Remove `paths::ITERATOR`
Mateusz Gacek [Fri, 12 Mar 2021 20:00:08 +0000 (12:00 -0800)]
mem_replace_with_default: use diagnostic items intead of paths
Mateusz Gacek [Mon, 1 Mar 2021 15:49:52 +0000 (16:49 +0100)]
mem_replace_with_default: recognize some std library ctors
Matthias Krüger [Fri, 12 Mar 2021 19:40:23 +0000 (20:40 +0100)]
inconsistent_struct_constructor: try to make message and lint description a bit clearer
Yoshitomo Nakanishi [Fri, 12 Mar 2021 17:09:19 +0000 (02:09 +0900)]
Use sym::Iterator instead of paths::ITERATOR
Yusuke Tanaka [Fri, 12 Mar 2021 11:46:46 +0000 (20:46 +0900)]
Improve suggestion and make it work for macros
bors [Thu, 11 Mar 2021 19:54:48 +0000 (19:54 +0000)]
Auto merge of #6826 - TaKO8Ki:refactor-methods-mod, r=phansch
Refactor: arrange lints in `methods` module
This PR arranges methods lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in #6680.
changelog: Move lints in methods module into their own modules.
bors [Thu, 11 Mar 2021 16:10:33 +0000 (16:10 +0000)]
Auto merge of #6884 - matthiaskrgr:lintcheck_crate, r=Manishearth
move lintcheck into its own crate
This pr:
* moves lintcheck out of `clippy dev` and into its own crate (`lintcheck`) (I should have done this earlier :D)
* makes lintcheck terminate if it is not launched from the repo root (to prevent problems with wrong paths when using `cargo run` in the crate root)
* fixes json lint messages leaking the runners `$HOME` when a lint messages comes from a proc macro that originates from a crate inside the `$CARGO_CACHE`
* adds more documentation to lintchecks `README.md` and mentions lintcheck in `docs/basics.md`
changelog: none
Matthias Krüger [Thu, 11 Mar 2021 14:47:51 +0000 (15:47 +0100)]
doc line length fixes
Matthias Krüger [Thu, 11 Mar 2021 14:37:10 +0000 (15:37 +0100)]
docs: basics.md: mention lintcheck
Matthias Krüger [Thu, 11 Mar 2021 14:25:43 +0000 (15:25 +0100)]
lintcheck: fix clippy warnings
Matthias Krüger [Thu, 11 Mar 2021 14:18:56 +0000 (15:18 +0100)]
lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
Matthias Krüger [Thu, 11 Mar 2021 14:05:13 +0000 (15:05 +0100)]
lintcheck: update logs
Matthias Krüger [Thu, 11 Mar 2021 13:29:00 +0000 (14:29 +0100)]
lintcheck: fix bug where lint messages about macros coming from crate deps would sneak in absolute paths to registry sources.
make the path a relative path that starts at the CARGO_HOME to not print the users home location in the log
Matthias Krüger [Tue, 9 Mar 2021 22:20:04 +0000 (23:20 +0100)]
lintcheck: update readme and remove the now redundant readme from clippy-dev
Matthias Krüger [Tue, 9 Mar 2021 13:40:59 +0000 (14:40 +0100)]
move testfiles to "lintcheck" and fix more paths
Matthias Krüger [Tue, 9 Mar 2021 13:08:26 +0000 (14:08 +0100)]
gitignore: add lintchecks target dir
Matthias Krüger [Tue, 9 Mar 2021 13:06:42 +0000 (14:06 +0100)]
lintcheck: make sure we lauch from the repo root
This will terminate the program if run via "cargo run".
"cargo run" does currently not work because at least a bunch of paths do not take that into account.
Matthias Krüger [Sat, 6 Mar 2021 09:06:52 +0000 (10:06 +0100)]
lintcheck: move out of clippy-dev into own crate
Takayuki Maeda [Thu, 11 Mar 2021 11:18:33 +0000 (20:18 +0900)]
fix interning-defined-symbol error
Takayuki Maeda [Thu, 11 Mar 2021 11:02:29 +0000 (20:02 +0900)]
remove unused imports
Takayuki Maeda [Sat, 6 Mar 2021 13:26:29 +0000 (22:26 +0900)]
move expect_fun_call to its own module
Takayuki Maeda [Sat, 6 Mar 2021 10:40:34 +0000 (19:40 +0900)]
move or_fun_call to its own module
Takayuki Maeda [Sat, 6 Mar 2021 10:31:46 +0000 (19:31 +0900)]
move map_unwrap_or to its own module
Takayuki Maeda [Sat, 6 Mar 2021 10:11:52 +0000 (19:11 +0900)]
move option_map_or_none to its own module
Takayuki Maeda [Sat, 6 Mar 2021 10:05:51 +0000 (19:05 +0900)]
unnecessary_fold to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:59:35 +0000 (18:59 +0900)]
move useless_asref to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:53:31 +0000 (18:53 +0900)]
move clone_on_copy to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:45:25 +0000 (18:45 +0900)]
move iter_skip_next to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:41:43 +0000 (18:41 +0900)]
move map_flatten and search_is_some to their own modules
Takayuki Maeda [Sat, 6 Mar 2021 09:30:40 +0000 (18:30 +0900)]
move flat_map_identity to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:22:15 +0000 (18:22 +0900)]
move filter_map_flat_map to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:19:18 +0000 (18:19 +0900)]
move filter_flat_map to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:11:42 +0000 (18:11 +0900)]
move filter_map_next to its own module
Takayuki Maeda [Sat, 6 Mar 2021 09:05:15 +0000 (18:05 +0900)]
move filter_map_map to its own module
Takayuki Maeda [Sat, 6 Mar 2021 08:55:29 +0000 (17:55 +0900)]
move filter_map to its own module
Takayuki Maeda [Sat, 6 Mar 2021 08:46:50 +0000 (17:46 +0900)]
move from_iter_insteam_of_collect to its own module
Takayuki Maeda [Sat, 6 Mar 2021 08:28:14 +0000 (17:28 +0900)]
move into_iter_on_ref and single_char_pattern to their own modules
Takayuki Maeda [Sat, 6 Mar 2021 06:39:28 +0000 (15:39 +0900)]
move single_char_push_string to its own module
Takayuki Maeda [Sat, 6 Mar 2021 06:29:02 +0000 (15:29 +0900)]
move single_char_insert_string to its own module
Takayuki Maeda [Thu, 4 Mar 2021 15:16:43 +0000 (00:16 +0900)]
move string_extend_chars and clone_on_ref_ptr to their own module
Takayuki Maeda [Thu, 4 Mar 2021 14:47:30 +0000 (23:47 +0900)]
move wrong_self_convention to its own module
Takayuki Maeda [Thu, 4 Mar 2021 14:06:05 +0000 (23:06 +0900)]
move iter_nth, iter_nth_zero and iterator_step_by_zero to their own module
Takayuki Maeda [Thu, 4 Mar 2021 13:50:53 +0000 (22:50 +0900)]
move iter_next_slice to its own module
Takayuki Maeda [Thu, 4 Mar 2021 10:47:06 +0000 (19:47 +0900)]
move map_collect_result_unit to its own module
Takayuki Maeda [Thu, 4 Mar 2021 10:46:44 +0000 (19:46 +0900)]
move zst_offset to its own module
Takayuki Maeda [Tue, 2 Mar 2021 16:16:16 +0000 (01:16 +0900)]
replace `lints` and `lint` with `check`
Takayuki Maeda [Tue, 2 Mar 2021 16:09:33 +0000 (01:09 +0900)]
move iter_cloned_collect to its own module
Takayuki Maeda [Tue, 2 Mar 2021 16:03:47 +0000 (01:03 +0900)]
move uninit_assumed_init to its own module
Takayuki Maeda [Tue, 2 Mar 2021 15:55:19 +0000 (00:55 +0900)]
move filetype_is_file to its own module
Takayuki Maeda [Tue, 2 Mar 2021 15:48:21 +0000 (00:48 +0900)]
move suspicious_map to its own module
Takayuki Maeda [Tue, 2 Mar 2021 15:43:27 +0000 (00:43 +0900)]
move option_as_ref_deref to its own module
Takayuki Maeda [Tue, 2 Mar 2021 15:31:15 +0000 (00:31 +0900)]
move skip_while_next to its own module
Takayuki Maeda [Tue, 2 Mar 2021 15:14:38 +0000 (00:14 +0900)]
move expect_used, filter_next, get_unwrap, ok_expect and unwrap_used to their own modules
bors [Thu, 11 Mar 2021 10:08:29 +0000 (10:08 +0000)]
Auto merge of #6881 - flip1995:rustup, r=flip1995
Rustup
changelog: none
flip1995 [Thu, 11 Mar 2021 09:57:49 +0000 (10:57 +0100)]
Fix remaining dogfood errors (internal lints)
flip1995 [Thu, 11 Mar 2021 09:38:49 +0000 (10:38 +0100)]
Bump nightly version => 2021-03-11
flip1995 [Thu, 11 Mar 2021 09:37:58 +0000 (10:37 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup
bors [Wed, 10 Mar 2021 16:40:33 +0000 (16:40 +0000)]
Auto merge of #6814 - hyd-dev:issue-6486, r=flip1995
Fix false positives on procedural macros of `missing_inline_in_public_items` lint
Fixes #6486.
changelog: Fix false positives on procedural macros of `missing_inline_in_public_items` lint.
bors [Wed, 10 Mar 2021 16:27:18 +0000 (16:27 +0000)]
Auto merge of #6794 - camsteffen:needless-borrowed-ref, r=flip1995
Improve needless_borrowed_ref docs
changelog: none
I think "borrowed ref" is a confusing description for this lint. Destructuring a reference is the opposite of borrowing. So I updated the wording throughout the docs. Unfortunately this nit applies to the name of the lint itself, but I won't bother changing that. One motivation for these changes is to clarify the difference between this lint and `needless_borrow` (they are actually quite different). Let me know if I need to clarify anything or if you disagree with any changes.
bors [Wed, 10 Mar 2021 08:40:51 +0000 (08:40 +0000)]
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.~~
bors [Tue, 9 Mar 2021 18:42:09 +0000 (18:42 +0000)]
Auto merge of #6878 - flip1995:authors, r=Manishearth
Set Clippy authors to "The Rust Clippy Developers"
Clippy has grown enough, that putting specific people in the "authors"
field isn't warranted anymore.
As a heads-up: `@Manishearth` `@llogiq` `@birkenfeld` `@mcarton` `@oli-obk` `@phansch` `@matthiaskrgr` your names will be removed from one or more of the `Cargo.toml` files of Clippy. This of course does not mean that we value your previous work on Clippy any less :heart:
As per our discussion in today's meeting: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202021-03-09/near/
229502514
changelog: none
Camille GILLOT [Fri, 27 Nov 2020 16:41:05 +0000 (17:41 +0100)]
Remove hir::Expr::attrs.
Camille GILLOT [Sun, 24 Jan 2021 12:17:54 +0000 (13:17 +0100)]
Remove hir::Item::attrs.
Camille GILLOT [Fri, 27 Nov 2020 08:55:10 +0000 (09:55 +0100)]
Remove hir::ImplItem::attrs.
Camille GILLOT [Fri, 27 Nov 2020 08:41:53 +0000 (09:41 +0100)]
Remove hir::TraitItem::attrs.
Camille GILLOT [Thu, 26 Nov 2020 23:27:34 +0000 (00:27 +0100)]
Remove hir::StructField::attrs.
Camille GILLOT [Thu, 26 Nov 2020 23:07:36 +0000 (00:07 +0100)]
Remove hir::Variant::attrs.
Camille GILLOT [Thu, 26 Nov 2020 22:46:48 +0000 (23:46 +0100)]
Remove hir::Arm::attrs.
Camille GILLOT [Thu, 26 Nov 2020 22:38:53 +0000 (23:38 +0100)]
Remove hir::Crate::attrs.
Camille GILLOT [Wed, 25 Nov 2020 21:45:24 +0000 (22:45 +0100)]
Remove hir::Local::attrs.
Camille GILLOT [Wed, 25 Nov 2020 21:07:09 +0000 (22:07 +0100)]
Remove hir::StmtKind::attrs.
Camille GILLOT [Fri, 27 Nov 2020 08:24:42 +0000 (09:24 +0100)]
Do not store attrs in FnKind.
Camille GILLOT [Sun, 6 Dec 2020 21:00:24 +0000 (22:00 +0100)]
Simplify clippy author.
kadmin [Sat, 23 Jan 2021 08:57:04 +0000 (08:57 +0000)]
Switch to changing cp_non_overlap in tform
It was suggested to lower this in MIR instead of ssa, so do that instead.
kadmin [Tue, 29 Dec 2020 02:00:04 +0000 (02:00 +0000)]
Update cranelift
kadmin [Mon, 5 Oct 2020 22:53:00 +0000 (22:53 +0000)]
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.
flip1995 [Tue, 9 Mar 2021 16:50:04 +0000 (17:50 +0100)]
Set Clippy authors to "The Rust Clippy Developers"
Clippy has grown enough, that putting specific people in the "authors"
field is warranted anymore.
bors [Tue, 9 Mar 2021 15:18:16 +0000 (15:18 +0000)]
Auto merge of #6876 - giraffate:improve_doc_on_map_flatten, r=flip1995
Improve doc on `map_flatten`
Fix https://github.com/rust-lang/rust-clippy/issues/6870. It's because this doc lacks the description that this lint is also used for `Option`.
changelog: none
Takayuki Nakata [Tue, 9 Mar 2021 15:02:24 +0000 (00:02 +0900)]
Improve doc on `map_flatten`
bors [Tue, 9 Mar 2021 14:58:24 +0000 (14:58 +0000)]
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`]
Andrea Nall [Tue, 9 Mar 2021 14:30:33 +0000 (08:30 -0600)]
add comment for when can be removed
bors [Tue, 9 Mar 2021 14:28:49 +0000 (14:28 +0000)]
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
bors [Tue, 9 Mar 2021 12:43:20 +0000 (12:43 +0000)]
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