Commit Graph

10935 Commits

Author SHA1 Message Date
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
ff51964102 Auto merge of #6825 - djc:naive-bytecount-pedantic, r=Manishearth
Move naive_bytecount to pedantic

As discussed on Zulip, current best practice is to avoid recommending
external crates. This lint is from before that was enforced. Move it
to the pedantic group to avoid enabling it by default.

https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency

changelog: move [`naive_bytecount`] to pedantic
2021-03-03 21:26:24 +00:00
bors
43d19f63f7 Auto merge of #6824 - Y-Nak:refactor_loops_module, r=flip1995
Refactor: organize loops file into loops module (Delegated)

`@flip1995` `@nahuakang`

closes #6693
r? `@flip1995`

 As we talked about in the PM of Zulip,  this PR is a delegated PR from `@nahuakang.`

Changes from the last commit of #6693:
1. Unify the name of the main entries of all modules to check, that was pointed out [here](https://github.com/rust-lang/rust-clippy/pull/6693#discussion_r582897713)
2. Simplify ` check_for_loop_arg`, that was pointed out [here](https://github.com/rust-lang/rust-clippy/pull/6693#discussion_r582914044) and [here](https://github.com/rust-lang/rust-clippy/pull/6693#discussion_r582929910)
3. Resolve conflicts

changelog: Refactor `loops.rs` file into `loops` module.
2021-03-03 10:34:22 +00: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
Dirkjan Ochtman
9e4a064f08 Move naive_bytecount to pedantic
As discussed on Zulip, current best practice is to avoid recommending
external crates. This lint is from before that was enforced. Move it
to the pedantic group to avoid enabling it by default.

https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency
2021-03-02 14:34:47 +01:00
Yoshitomo Nakanishi
19c886b407 Remove "for_loop_arg.rs" 2021-03-02 21:09:10 +09:00
bors
eb04beb005 Auto merge of #6791 - TaKO8Ki:iter-count, r=matthiaskrgr
New lint: `iter_count`

This pull request adds a new lint named `iter_count`.

---

closes https://github.com/rust-lang/rust-clippy/issues/6262

changelog: new lint `iter_count`
2021-03-02 11:31:43 +00:00
bors
3cd6ca051c Auto merge of #6716 - magurotuna:refactor-transmute-mod, r=flip1995
Refactor: arrange transmute lints

This PR arranges `transmute` lints so that they can be accessed more easily.
Basically, I followed the instruction described in #6680 as to how to do the refactoring.

- `declare_clippy_lint!` and `impl LintPass` is placed in `transmute/mod.rs`
- Uitlity functions is placed in `transmute/utils.rs`
- Each lint function about `transmute` is moved into its own module, like `transmute/useless_transmute.rs`

For ease of review, I refactored step by step, keeping each commit small. For instance, all I did in
2451781 was to move  `useless_transmute` into its own module.

---

changelog: Refactor `transmute.rs` file into `transmute` module.
2021-03-02 09:44:03 +00:00
Yusuke Tanaka
bf000985f5
Make check_cast private 2021-03-02 10:40:25 +01:00
Yusuke Tanaka
8a8f7b4cf5
Refactor calls to lint check functions 2021-03-02 10:40:25 +01:00
Yusuke Tanaka
89ef26a681
Cleanup imports 2021-03-02 10:40:25 +01:00
Yusuke Tanaka
25c221ec92
Move transmutes_expressible_as_ptr_casts to its own module 2021-03-02 10:40:24 +01:00
Yusuke Tanaka
c57a8260f2
Move unsound_collection_transmute to its own module 2021-03-02 10:40:24 +01:00
Yusuke Tanaka
e7d2393d01
Move transmute_float_to_int to its own module 2021-03-02 10:40:24 +01:00
Yusuke Tanaka
acedc7b8f2
Move transmute_int_to_float to its own module 2021-03-02 10:40:24 +01:00
Yusuke Tanaka
d04ea41d1f
Move transmute_int_to_bool to its own module 2021-03-02 10:40:24 +01:00
Yusuke Tanaka
f8bc0e249c
Move transmute_ptr_to_ptr to its own module 2021-03-02 10:40:23 +01:00
Yusuke Tanaka
7af3458b54
Move transmute_bytes_to_str and transmute_ptr_to_ptr to transmute_ref_to_ref module 2021-03-02 10:40:23 +01:00
Yusuke Tanaka
4c65221188
Move transmute_int_to_char to its own module 2021-03-02 10:40:23 +01:00
Yusuke Tanaka
6442d45d3a
Move transmute_ptr_to_ref to its own module 2021-03-02 10:40:23 +01:00
Yusuke Tanaka
afc9275928
Move crosspointer_transmute to its own module 2021-03-02 10:37:30 +01:00
Yusuke Tanaka
ef97764dcc
Move wrong_transmute to its own module 2021-03-02 10:37:30 +01:00
Yusuke Tanaka
0d7dd00860
Move useless_transmute to its own module 2021-03-02 10:37:30 +01:00
Yusuke Tanaka
4ac438bfed
Add transmute/utils.rs 2021-03-02 10:37:30 +01:00
Yusuke Tanaka
306545ff96
Create transmute directory 2021-03-02 10:37:30 +01:00
Yoshitomo Nakanishi
74bd806b05 Simplify check_for_loop_arg 2021-03-02 18:14:20 +09:00
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
bors
e50afa43d0 Auto merge of #6822 - camsteffen:rustfmt, r=llogiq
Rustfmt version "Two"

changelog: none

This enables some ~bug fixes~ changes from rustfmt. This is more consistent with rustc's config, and should be more forward-compatible. Also, the changes look good IMO. 😃
2021-03-02 08:57:11 +00:00
Jason Newcomb
2c485e36cd
Don't move yield or inline assembly into closure 2021-03-01 17:25:23 -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
bors
5ae1e17e81 Auto merge of #6813 - matthiaskrgr:lintcheck_refactor, r=flip1995
lintcheck, do some refactoring and add more sources

refactor: add a Config object
don't run in parallel mode by default (it didn't make sense because cargo would lock the shared target dir anyway)
show full paths (from repo root) to the source files in clippy warnings so we can just copy the path from the logfile
fix more bugs
add more crates by dtolnay and embark to the sources toml

changelog: lintcheck: refactor some code and add more sources
2021-03-01 11:37:08 +00:00