Commit Graph

14509 Commits

Author SHA1 Message Date
bors
3206fb4eb1 Auto merge of #9138 - Jarcho:branches_sharing_code_2, r=giraffate
Fixes for `branches_sharing_code`

fixes #7198
fixes #7452
fixes #7555
fixes #7589

changelog: Don't suggest moving modifications to locals used in any of the condition expressions in `branches_sharing_code`
changelog: Don't suggest moving anything after a local with a significant drop in `branches_sharing_code`
2022-07-12 00:38:54 +00:00
bors
8a801c7b83 Auto merge of #9154 - CeleritasCelery:master, r=flip1995
Remove broken link in CONTRIBUTING.md

changelog: none
2022-07-11 21:14:23 +00:00
Troy Hinckley
57a8f6dd9d Fix broken link in CONTRIBUTING.md 2022-07-11 15:49:11 -05:00
bors
7c1598b399 Auto merge of #9152 - mati865:patch-2, r=xFrednet
Fix Clippy version in `derive_partial_eq_without_eq` lint

It was first added to Rust in https://github.com/rust-lang/rust/pull/97248 which missed 1.62 just by few days.

changelog: none
2022-07-11 15:07:33 +00:00
Mateusz Mikuła
c8d32e53a2
Fix Clippy version in derive_partial_eq_without_eq lint
It was first added to Rust in https://github.com/rust-lang/rust/pull/97248 which missed 1.62 just by few days.
2022-07-11 17:01:46 +02:00
bors
8a62b6f523 Auto merge of #9144 - alex-semenyuk:or_fun_call_span_fix, r=giraffate
Fix span for or_fun_call

Closes #9033
changelog: [`or_fun_call`]: span points to the `unwrap_or` only instead of through the entire method chain expression
2022-07-11 09:03:20 +00:00
alex-semenyuk
c3c4cda50b Address review 2022-07-11 10:34:01 +03:00
bors
7ea4592a8b Auto merge of #9056 - Jarcho:let_unit_indirect, r=llogiq
Allow `let_unit_value` in more cases

fixes #8998

changelog: Lint `let_unit_value` less aggressively when the type is specified
2022-07-10 18:58:09 +00:00
alex-semenyuk
783992e693 Fix dogfood issue for or_fun_call 2022-07-10 13:34:58 +03:00
alex-semenyuk
97cd46fa33 Fix span for or_fun_call 2022-07-10 13:11:19 +03:00
bors
4d1b976b1d Auto merge of #9141 - alex-semenyuk:grammar_fix, r=dswij
Fix small mistakes

changelog: none
2022-07-09 15:58:58 +00:00
bors
3468294b58 Auto merge of #9140 - Jarcho:sig_drop, r=flip1995
Ignore `into_iter` in `significant_drop_in_scrutinee`

fixes #9135
changelog: Ignore the `IntoIterator::into_iter` call from for loops in `significant_drop_in_scrutinee`
2022-07-09 12:34:03 +00:00
Jason Newcomb
95b78799c3 Ignore the IntoIterator::into_iter call from for loops in significant_drop_in_scrutinee 2022-07-09 08:15:13 -04:00
alex-semenyuk
9015884325 Fix small mistakes 2022-07-09 13:00:24 +03:00
Jason Newcomb
55563f9ce1 Fixes for branches_sharing_code
* Don't suggest moving modifications to locals used in any of the condition expressions
* Don't suggest moving anything after a local with a significant drop
2022-07-08 20:07:55 -04:00
bors
526f02ef05 Auto merge of #9137 - alex-semenyuk:small_cosmetic_fix, r=xFrednet
Fix example header

changelog: fix example header
2022-07-08 19:14:51 +00:00
alexey semenyuk
4e60134ec3
Fix example header 2022-07-08 22:07:44 +03:00
Jason Newcomb
d251bd96e7 Add for_each_expr 2022-07-08 12:54:20 -04:00
bors
49f73e14a9 Auto merge of #8356 - J-ZhengLi:master-issue8288, r=dswij
Simplify if let statements

fixes: #8288

---

changelog: Allowing [`qustion_mark`] lint to check `if let` expressions that immediatly return unwrapped value
2022-07-08 16:12:00 +00:00
bors
d0b8f7508c Simplify if let statements
fixes: #8288

---

changelog: Allowing [`qustion_mark`] lint to check `if let` expressions that immediatly return unwrapped value
2022-07-08 16:12:00 +00:00
Jason Newcomb
2872b7e0a4 Allow let () = .. as type inference for let_unit_value 2022-07-07 20:06:37 -04:00
Jason Newcomb
196174ddad Changes to let_unit_value
* View through locals in `let_unit_value` when determining if inference is required
* Don't remove typed let bindings for more functions
2022-07-07 20:06:36 -04:00
bors
54feac18d1 Auto merge of #8958 - Alexendoo:simple_filter_map, r=giraffate
Lint simple expressions in `manual_filter_map`, `manual_find_map`

changelog: Lint simple expressions in [`manual_filter_map`], [`manual_find_map`]

The current comparison rules out `.find(|a| a.is_some()).map(|b| b.unwrap())` because `a` being a reference can effect more complicated expressions, this adds a simple check for that case and adds the necessary derefs

There's some overlap with `option_filter_map` so `lint_filter_some_map_unwrap` now returns a `bool` to indicate it linted
2022-07-07 23:39:12 +00:00
bors
2058b92777 Auto merge of #9120 - anall:bugfix/ice9041, r=Jarcho
Fix ICE in sugg::DerefDelegate with (named) closures

rustc comiler internals helpfully tell us how to fix the issue:
```
  to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`
```
Fixes ICE in #9041

This also makes this code in `sugg::DerefDelegate` match a different use `typ.fn_sig(…)` I found: in `mixed_read_write_in_expression` -- being strict on the value of `typ.kind()` will hopefully reduce any future possibility of ICE crashes in this area.

---

changelog: none
2022-07-07 23:04:29 +00:00
Andrea Nall
782b484b79 Fix ICE in sugg::DerefDelegate with (named) closures
rustc comiler internals helpfully tell us how to fix the issue:

  to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`

Fixes ICE in #9041
2022-07-07 16:10:36 -05:00
bors
7142a59674 Auto merge of #9132 - hellow554:maybe_trait_bound_on_type_repetition, r=Manishearth
Maybe trait bound on type repetition

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: fix maybe trait on [`type_repetition_in_bounds`] lint

I simplified the two for loops, which did exactly the same. Only downside is, that I need a `copied`, but that's to convert from `&&` to `&`, to that should be a noop?

One more thing: I only handle [`TraitBoundModifier::Maybe`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TraitBoundModifier.html#variant.Maybe). Can anyone give me an example (and testcase) for [`TraitBoundModifier::MaybeConst`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TraitBoundModifier.html#variant.MaybeConst)?

closes #8770
2022-07-07 15:29:43 +00:00
Alex Macleod
307b8cd825 Lint simple expressions in manual_filter_map, manual_find_map 2022-07-07 11:51:42 +00:00
Marcel Hellwig
ead2c4f122 fix incorrect suggestion for maybe trait bounds 2022-07-07 12:43:16 +02:00
Marcel Hellwig
f2bef55389 trait_bounds: rework two loops into one
the two loops did practically the same, only the type were different (&&
vs &), so I used `copied` to convert `&&` and chained them together.
Instead of parsing the trait info manually, I use the already provided
method `get_trait_info_from_bound`.
Also, instead of using manual string writing, I used `join` by
`itertools`.
2022-07-07 12:43:16 +02:00
bors
afb34eb261 Auto merge of #9096 - Jarcho:needless_borrow_subs, r=Manishearth
Fix `needless_borrow` 9095

fixes #9095
changelog: Don't lint `needless_borrow` on method receivers when it would change which trait impl is called
2022-07-06 21:26:46 +00:00
bors
f93d418f17 Auto merge of #9099 - joshtriplett:unnecessary-lazy-eval-then-some, r=flip1995
Extend unnecessary_lazy_eval to cover `bool::then` -> `bool::then_some`

fixes #9097

changelog: Extend `unnecessary_lazy_eval` to convert `bool::then` to `bool::then_some`
2022-07-06 09:20:55 +00:00
Josh Triplett
b7230d4f44 Dogfood fixes to use bool::then_some 2022-07-06 02:03:56 -07:00
Josh Triplett
ebff7206bc Add MSRV check for bool::then_some 2022-07-06 01:00:19 -07:00
Josh Triplett
528308b5aa Extend unnecessary_lazy_eval to cover bool::then -> bool::then_some 2022-07-06 00:48:51 -07:00
bors
fd605ab7e4 Auto merge of #9124 - Jarcho:shadow_ice, r=Alexendoo
Lint `shadow_*` lints in anon const blocks

changelog: Lint `shadow_*` lints in anon const blocks
2022-07-05 20:04:14 +00:00
Jason Newcomb
3db0e00bdc Lint shadow_* lints in anon const blocks 2022-07-05 15:21:27 -04:00
bors
462136ac68 Auto merge of #9121 - alex-semenyuk:fix_ui_test_cast_32_bits, r=flip1995
Fix stderr for cast_size_32bit

changelog: fix stderr for cast_size_32bit
2022-07-05 08:57:12 +00:00
alexey semenyuk
2ccb05487c
Fix stderr for cast_size_32bit 2022-07-05 09:43:29 +03:00
bors
48e527e4bd Auto merge of #9117 - Jarcho:unsafe_block_closure, r=giraffate
Fix `undocumented_unsafe_blocks` in closures

fixes #9114
changelog: Fix `undocumented_unsafe_blocks` not checking for comments before the start of a closure
2022-07-05 00:20:33 +00:00
bors
c257f098a8 Auto merge of #9115 - Alexendoo:new-with-const-generics, r=llogiq
`new_without_default`: ignore const generics/lifetime params on `fn new`

Fixes #9113

No longer lints if `fn new` has any params

changelog: [`new_without_default`]: no longer lints const generics and lifetime params on `fn new`
2022-07-04 18:19:37 +00:00
Jason Newcomb
975667945c Fix undocumented_unsafe_blocks in closures 2022-07-04 13:53:42 -04:00
Alex Macleod
fec4593082 new_without_default: ignore const generics/lifetime params on fn new 2022-07-04 14:03:11 +00:00
bors
b15f06e74f Auto merge of #9093 - Jarcho:deref_ice, r=giraffate
Fix ICE in `dereference.rs`

fixes #9089
changelog: Fix ICE when dereferencing or borrowing on explicit returns from closures
2022-07-04 00:22:17 +00:00
bors
8c8987749b Auto merge of #9105 - Serial-ATA:lint-invalid-utf8, r=Jarcho
Add `invalid_utf8_in_unchecked`

changelog: Add [`invalid_utf8_in_unchecked`]
closes: #629

Don't know how useful of a lint this is, just saw this was a really old issue 😄.
2022-07-03 20:02:38 +00:00
Serial
de646e10db Add invalid_utf8_in_unchecked 2022-07-03 15:37:30 -04:00
bors
be9e35f6b2 Auto merge of #9110 - alex-semenyuk:fix_trailling_commas, r=xFrednet
Remove trailing spaces

Closes #9108
changelog: remove trailing spaces,  which are not allowed by the JSON standard.
2022-07-03 19:33:01 +00:00
alexey semenyuk
9ef76e051b
Fixed comment 2022-07-03 19:03:51 +00:00
bors
0fd4f1c75b Auto merge of #9112 - xFrednet:9088-fix-lint-versions, r=Jarcho
Correct `[clippy::version]` for 1.62 lints and add note to docs

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

changelog: none

---

It feels weird to have such a short PR description. So, what should I add to this one... Yes, art:

```txt
 ,-----.,--.,--.
'  .--./|  |`--' ,---.  ,---.,--. ,--.
|  |    |  |,--.| .-. || .-. |\  '  /
'  '--'\|  ||  || '-' '| '-' ' \   '
 `-----'`--'`--'|  |-' |  |-'.-'  /
                `--'   `--'  `---'
```

```txt
 ,-----.,--.   ,--.,------. ,------.,--.   ,--.
'  .--./|  |   |  ||  .--. '|  .--. '\  `.'  /
|  |    |  |   |  ||  '--' ||  '--' | '.    /
'  '--'\|  '--.|  ||  | --' |  | --'    |  |
 `-----'`-----'`--'`--'     `--'        `--'
```

```txt
   _____ _      _____ _____  _______     __
  / ____| |    |_   _|  __ \|  __ \ \   / /
 | |    | |      | | | |__) | |__) \ \_/ /
 | |    | |      | | |  ___/|  ___/ \   /
 | |____| |____ _| |_| |    | |      | |
  \_____|______|_____|_|    |_|      |_|
```
2022-07-03 18:41:54 +00:00
xFrednet
2dd5fc14da
Correct [clippy::version] for 1.62 lints and add note to docs 2022-07-03 17:02:48 +02:00
alexey semenyuk
65655d1e1e
Remove trailing spaces 2022-07-03 17:44:09 +03:00