Commit Graph

5458 Commits

Author SHA1 Message Date
Yoshitomo Nakanishi
eaf63d6df7 Unify names of lint entry functions in loops to 'check' 2021-03-02 18:14:20 +09:00
nahuakang
845a3a061c Include loops.rs changes from PR#6698 2021-03-02 18:14:20 +09:00
nahuakang
2229a0839e Clean up: Rename some files to be consistent with lint names; import lints to each file 2021-03-02 18:14:20 +09:00
nahuakang
ecebfe0c9c Move check_for_loop_arg back to mod; split into 4 lint files 2021-03-02 18:14:20 +09:00
nahuakang
7cfdef6de1 Move MinifyingSugg into manual_memcpy 2021-03-02 18:14:20 +09:00
nahuakang
7158c944a4 Refactor while let loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang
287a4f8ab1 Refactor empty loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang
d0b657c0b7 Refactor while let on iterator lint to its module; rename for loop explicit counter to explicit counter loop 2021-03-02 18:14:20 +09:00
nahuakang
455d0476b1 Refactor never loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang
5b870e1b36 Move detect_manual_memcpy to its module; split up utils structs 2021-03-02 18:14:20 +09:00
nahuakang
2c1f676bfe Add detect_same_item_push to its own module 2021-03-02 18:14:20 +09:00
nahuakang
453e6b97ac Add check_needless_collect to its own module 2021-03-02 18:14:20 +09:00
nahuakang
9520cba554 Add check_infinite_loop to its own module 2021-03-02 18:13:32 +09:00
nahuakang
1e5e541ac5 Refactor check_for_single_element_loop to its own module 2021-03-02 18:13:32 +09:00
nahuakang
71026cad54 Refactor check_for_loop_explicit_counter to its own module 2021-03-02 18:13:32 +09:00
nahuakang
71c9fdf8b1 Refactor check_for_loop_range into its module 2021-03-02 18:13:32 +09:00
nahuakang
6e4663dedf Refactor check_for_mut_range_bound to its own module 2021-03-02 18:13:32 +09:00
nahuakang
7b0f588b77 Refactor check_for_loop_over_map_kv to its own module 2021-03-02 18:13:32 +09:00
nahuakang
408368a82c Refactor check_for_loop_arg; rename manual_flatten's lint back to check_manual_flatten 2021-03-02 18:13:32 +09:00
nahuakang
62ac4bd1b2 create loops dir; arrange manual_flatten lint and utils 2021-03-02 18:13:32 +09: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
Matthias Krüger
e00b1cc73a change some lint messages and remove old entries from the ignorelist 2021-02-28 02:22:05 +01:00
Matthias Krüger
8eb2bd13d0 update the lint messages and tests 2021-02-28 02:22:05 +01:00
Yoshitomo Nakanishi
bdeec5dbd6 Use TypeckResults::expr_ty instead of TyCtxt::type_of to fix "Not a type" ICE 2021-02-27 22:57:29 +09:00
Andrea Nall
3d3cfd3754 added new lint implicit_clone 2021-02-26 19:13:47 -06:00
David Tolnay
8f47a4214e
Downgrade manual_map to nursery 2021-02-25 20:31:24 -08:00
bors
d5223be2e3 Auto merge of #6601 - mdm:fix-unit-args-false-positive, r=camsteffen
Fix false positive for unit_arg lint

Fixes #6447

To avoid false positives don't complain about unit args when they come from a path expression, e.g. a local variable.

**Note:** This is my first contribution to Clippy, so I might have messed up somewhere. Any feedback is welcome and I'm happy to work out any kinks.

---

changelog: Do not lint unit arguments when they come from a path expression.
2021-02-25 21:16:02 +00:00
bors
5c6cd87b94 Auto merge of #6790 - mgacek8:issue_6748, r=Manishearth
or_fun_call: fix suggestion for `or_insert(vec![])`

fixes #6748
changelog: or_fun_call: fix suggestion for `or_insert(vec![])` on `std::collections::hash_map::Entry` or `std::collections::btree_map::Entry`
2021-02-25 15:05:06 +00:00
Mateusz Gacek
2f0e9f7d3a or_fun_call: fix suggestion for or_insert(vec![])
Applies for `std::collections::hash_map::Entry` and `std::collections::btree_map::Entry`

Example:
Previously, for the following code:
`let _ = hash_map.entry("test".to_owned()).or_insert(vec![]);`
clippy would suggest to use:
`or_insert_with(vec![])`, which causes a compiler error (E0277).

Now clippy suggests:
`or_insert_with(Vec::new)`
2021-02-25 14:23:38 +01:00
bors
928e72dd10 Auto merge of #6789 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: None
2021-02-25 09:49:12 +00:00
flip1995
c6408a47bd
Merge remote-tracking branch 'upstream/master' into rustup 2021-02-25 10:40:00 +01:00
bors
ef41f2baf7 Auto merge of #6788 - matthiaskrgr:upper_case_acronyms, r=flip1995
move upper_case_acronyms back to style, but make the default behaviour less aggressive by default (can be unleashed via config option)

Previous discussion in the bi-weekly clippy meeting for reference: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202021-02-23/near/227458019

Move the `upper_case_acronyms` lint back to the style group.
Only warn on fully-capitalized names by default.
Add add a clippy-config option `upper-case-acronyms-aggressive: true/false` to enabled more aggressive linting on
all substrings that could be capitalized acronyms.

---
changelog: reenable upper_case_acronyms by default but make the more aggressive linting opt-in via config option
2021-02-25 09:01:41 +00:00
Matthias Krüger
2a6b06108d run cargo dev update_lints
fix sentence / address review comments
2021-02-25 09:59:39 +01:00
Matthias Krüger
913c71018c upper_case_acronyms: add io-toml tests and bless previous tests 2021-02-24 23:50:55 +01:00
Matthias Krüger
59750dceb8 upper_case_acronyms: add optional aggressive mode and relax default
Moves the lint back from pedantic to style group.
The lint default now only warns on names that are completely capitalized, like "WORD"
and only if the name is longer than 2 chars (so that names where each of the letter represents a word are still distinguishable).
For example: FP (false positive) would still be "valid" and not warned about (but EOF would warn).

A "upper_case_acronyms_aggressive: true/false" config option was added that restores the original lint behaviour to warn
on any kind of camel case name that had more than one capital letter following another capital letter.
2021-02-24 23:50:53 +01:00
avitex
72e3335684
Add OpenDNS to doc-valid-idents 2021-02-25 09:30:33 +11:00
Marc Dominik Migge
9fe9d94abd Don't lint unit args if expression kind is path 2021-02-24 13:31:04 +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 III
b7f03c6697 Remove unused features 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
8d2de8f256 Update clippy_lints/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
bors
a2c25fa9f0 Auto merge of #6573 - Jarcho:option_match_map, r=llogiq
New lint: option_manual_map

fixes: #6
changelog: Added lint: `match_map`
2021-02-23 21:56:25 +00:00
bors
0984754dd7 Auto merge of #6777 - giraffate:remove_unneeded_blank_lines_from_doc, r=phansch
Remove unneeded blank lines from doc

Remove unneeded blank lines like below.
<img width="1142" alt="スクリーンショット 2021-02-22 23 01 17" src="https://user-images.githubusercontent.com/17407489/108719295-bb9ff800-7562-11eb-9338-8f2571e61c56.png">

changelog: none
2021-02-23 06:05:27 +00:00
Takayuki Nakata
e05965eb13 Remove unneeded blank lines from doc 2021-02-22 23:02:04 +09:00
Matthias Krüger
0eefa6169d upper_case_acronyms: move lint from style to pedantic lint group
The lint does point out inconsistency with the Rust naming convention,
but the fact that rustc does not warn about the inconsistency by default
means that clippy probably should not warn by default either.

changelog: move upper_case_acronyms lint from style to pedantic group.
2021-02-22 12:30:28 +01:00
bors
fe01ddc8bc Auto merge of #6769 - Y-Nak:inconsistent-struct-constructor, r=matthiaskrgr
Inconsistent struct constructor

fixes: #6352
r? `@matthiaskrgr`

I added the lint that checks for the struct constructors where the order of the field init shorthands is inconsistent with that in the struct definition.

changelog: Add style lint: `inconsistent_struct_constructor`
2021-02-22 09:29:20 +00:00
Jason Newcomb
23aa2f880c
Fix dogfood errors 2021-02-21 23:15:28 -05:00
Jason Newcomb
efe33f9fe4
Add: option_manual_map lint 2021-02-21 22:06:03 -05:00