Commit Graph

14492 Commits

Author SHA1 Message Date
Allen Hsu
8878d674b1 Lint for repeated traits within trait bounds or where clauses. 2022-07-12 22:03:55 +10: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
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
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
bors
b8bdbb7a00 Auto merge of #9106 - usefulmove:master, r=flip1995
corrected README.md book link

This change corrects the book link on the Clippy Book README.md.

changelog: none
2022-07-03 13:10:07 +00:00
Duane
815a3ccd79 corrected README.md book link 2022-07-02 20:41:58 -07:00
Jason Newcomb
988b813649 Use correct substitutions when checking if needless_borrow can apply to a method receiver 2022-07-02 15:48:46 -04:00
Jason Newcomb
3e80d3988d Fix ICE in dereference.rs 2022-07-02 00:59:58 -04:00
bors
8c341d66a1 Auto merge of #9087 - alex-semenyuk:fix_link, r=llogiq
Fix broken link

changelog: none
2022-07-01 18:39:54 +00:00
alexey semenyuk
7350525ffb
Fix link 2022-07-01 18:31:57 +00:00
bors
f30b68d9d6 Auto merge of #9085 - xFrednet:9081-update-format-push-version, r=Manishearth,flip1995
Correct lint version for `format_push_string`

Closes #9081

changelog: none

IDK what else to say. Look I can draw an ascii penguin =D:

```
 (^v^)
<(   )>
  w w
```
2022-07-01 16:51:34 +00:00
xFrednet
a86bf81e44
Correct lint version for format_push_string 2022-07-01 18:05:45 +02:00
bors
097f7654b5 Auto merge of #9082 - Alexendoo:let_unit_allow, r=xFrednet
Fix direct `#[allow]` attributes in `let_unit_value`

Fixes part of #9080

Not sure why it doesn't work when the lint is emitted at the statement, but switching it to the local works fine

changelog: Fix direct `#[allow]` attributes in [`let_unit_value`]
2022-07-01 15:51:41 +00:00
bors
d8970bfa08 Auto merge of #9083 - giraffate:fix_link_in_changelog, r=flip1995
Fix some links

changelog: none
2022-07-01 12:55:38 +00:00
Takayuki Nakata
1988375a25 Fix some links 2022-07-01 21:30:59 +09:00
Alex Macleod
a5b70a4c1d Fix allow attributes in let_unit_value 2022-07-01 12:14:28 +00:00
bors
d4488a520a Auto merge of #9039 - Serial-ATA:dev-dogfood, r=giraffate
Add `cargo dev dogfood`

changelog: Add `cargo dev dogfood`

Part of #5394
2022-07-01 01:07:25 +00:00
bors
23db5ce261 Auto merge of #9075 - Serial-ATA:update-docs, r=flip1995
Add `dev deprecate` to the development basics

changelog: none
2022-06-30 20:55:04 +00:00
bors
6177a4f593 Auto merge of #9078 - hamza1311:patch-1, r=xFrednet
Fix broken hyperlink in documentation

changelog: none

The hyperlinks in [`is_digit_ascii_radix`](https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix)'s docs are broken. This PR fixes those.
2022-06-30 19:24:50 +00:00
Muhammad Hamza
a2b8a67777
Fix broken hyperlink 2022-07-01 00:14:38 +05:00
bors
2d0195986c Auto merge of #9058 - xFrednet:changelog-1-62, r=flip1995
Changelog for Rust 1.62 🦖

This special artifact was just discovered. The artifact details changes to something called Clippy. Presently and from the context, we were unable to determine what this is supposed to be. All we know, is that it seems to have an active community around it which supports it. The members sometimes use paper clips as a secret symbol for Clippy.

I want to donate this artifact to the rust-lang organization, to have it displayed to the public.

---

changelog: none
2022-06-30 17:33:33 +00:00