Commit graph

13988 commits

Author SHA1 Message Date
Serial
27fec01fa8 Add copy lint name button 2022-05-18 10:19:50 -04:00
bors
bf2e63104d Auto merge of #8807 - Jarcho:cmp_owned, r=giraffate
Fix `cmp_owned` on copy types

fixes #8803
fixes #7365

changelog: Don't lint `cmp_owned` on `From::from` for copy types
2022-05-18 00:19:36 +00:00
bors
d901079ca1 Auto merge of #8814 - yonip23:add-suggestion-to-rc-clone-in-vec-init, r=xFrednet
add suggestions to rc_clone_in_vec_init

A followup to https://github.com/rust-lang/rust-clippy/pull/8769
I also switch the order of the 2 suggestions, since the loop initialization one is probably the common case.

`@xFrednet` I'm not letting you guys rest for a minute 😅
changelog: add suggestions to [`rc_clone_in_vec_init`]
2022-05-17 05:46:00 +00:00
bors
219d702258 Auto merge of #8835 - Jarcho:let_unit_ice, r=llogiq
Fix ICE in `let_unit_value` when calling a static or const callable type

fixes #8821

changelog: Fix ICE in `let_unit_value` when calling a static or const callable type
2022-05-16 19:20:44 +00:00
bors
6e86ab007c Auto merge of #8752 - Serial-ATA:improve-filtering, r=xFrednet
Add version filtering option to the lint list

I'm no web dev, so I don't know if this is the best execution 😄.

Here's how it looks:

![Desktop](https://user-images.githubusercontent.com/69764315/165403602-9e39fe0f-6a96-46cb-ba51-8b035e74cce4.gif)

And on mobile:

![Mobile](https://user-images.githubusercontent.com/69764315/165403908-fc4a0051-2ed4-48a3-b45b-b261f49ce259.png)

I've split this into two commits, in the second one I moved the JS into its own file to make it easier to work on. Is that alright? And if so, could the same thing be done to the css?

changelog: none
cc: #7958, `@repi`
r? `@xFrednet`
2022-05-16 17:49:00 +00:00
Jason Newcomb
c649d4e8a7 Fix ICE in let_unit_value when calling a static or const callable type 2022-05-16 10:00:32 -04:00
bors
a1632fffc1 Auto merge of #8761 - tamaroning:fix_8505, r=Jarcho
`undocumented_unsafe_blocks` does not trigger on unsafe trait impls

Closes #8505

changelog: This lint checks unsafe impls NOT from macro expansions and checks ones in macro declarations.
~~`unsafe impl`s from macro invocations don't trigger the lint for now.~~
~~This lint checks unsafe impls from/not from macro expansions~~
2022-05-16 00:47:10 +00:00
bors
6ec735962f Auto merge of #8699 - Jarcho:vec_init_then_push_7071, r=dswij,xFrednet
Don't lint `vec_init_then_push` when further extended

fixes #7071

This will still lint when a larger number of pushes are done (four currently). The exact number could be debated, but this is more readable then a sequence of pushes so it shouldn't be too large.

changelog: Don't lint `vec_init_then_push` when further extended.
changelog: Remove `mut` binding from `vec_init_then_push` when possible.
2022-05-15 21:51:24 +00:00
Jason Newcomb
f1574cc131 Update vec_init_then_push docs 2022-05-15 17:39:39 -04:00
bors
1c0a61e7ce Auto merge of #8621 - Jarcho:eval_order_dependence_4637, r=Jarcho
Rename `eval_order_dependence` to `mixed_read_write_expression`, move to nursery

As per the [reference](https://doc.rust-lang.org/1.51.0/reference/expressions.html#evaluation-order-of-operands) evaluation order is now defined.

I'm pretty sure rust always compiled with this evaluation order anyways so there's no reason the put an msrv limit on the lint.

changelog: Rename `eval_order_dependence` to `mixed_read_write_expression`, move to nursery
2022-05-15 21:36:24 +00:00
Jason Newcomb
f7378daf71 Add renamed lints to the changelog link list 2022-05-15 17:10:48 -04:00
Jason Newcomb
4fd2968242 Move mixed_read_write_in_expression into restriction 2022-05-15 17:08:48 -04:00
Jason Newcomb
50eada16f7 Rename eval_order_dependence to mixed_read_write_in_expression 2022-05-15 17:08:45 -04:00
Serial
f112e4d445 Improve appearance on smaller screens 2022-05-15 12:43:35 -04:00
Serial
b81d703970 Use early returns 2022-05-15 11:30:00 -04:00
bors
c10bfae658 Auto merge of #8832 - Alexendoo:duplicate-mod, r=Manishearth
Add `duplicate_mod` lint

Inspired by #8827, warns if there's a single file that is loaded by more than one `mod` item

```rust,ignore
// lib.rs
mod a;
mod b;
```
```rust,ignore
// a.rs
#[path = "./b.rs"]
mod b;
```

It adds a `canonicalize` call per `mod file;` encountered, which I don't think should be too heavy

Integration tests with common modules, e.g. [`test_utils`](2038084cf2/tests/test_utils) doesn't trigger it as each test is compiled separately, however I couldn't figure out a good way to add a test for that

changelog: Add [`duplicate_mod`] lint
2022-05-15 03:52:37 +00:00
Serial
a30587e0fe Switch input to type=number; Separate version validation out of byVersion 2022-05-14 20:08:10 -04:00
Alex Macleod
1f79a442e5 Add duplicate_mod lint 2022-05-14 22:31:13 +01:00
bors
2038084cf2 Auto merge of #8813 - evantypanski:redundant_alloc_fat_ptr, r=Alexendoo
Fix redundant_allocation warning for Rc<Box<str>>

changelog: [`redundant_allocation`] Fixes #8604

Fixes false positives where a fat pointer with `str` type was made thin by another allocation, but that thinning allocation was marked as redundant
2022-05-13 15:02:58 +00:00
Evan Typanski
ad7338e565 Comment why hir_ty_to_ty is safe in check_ty 2022-05-13 05:55:50 -04:00
bors
01d75b1950 Auto merge of #8825 - ydah:fix_spelling, r=giraffate
Tweak some words improved representation

Hello! Thank you for this awesome project!

This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"

---

changelog: none
2022-05-13 06:03:39 +00:00
ydah
4e5f69cc86 Tweak some words improved representation
This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"
2022-05-13 14:20:25 +09:00
bors
b54f4468a2 Auto merge of #8799 - Alexendoo:lintcheck-common, r=giraffate
Some lintcheck cleanup

A grab bag of smaller changes:

Panics if a crate source isn't valid, and fixes the `ryu` crate entry so it's picked up. Took me a while to realise why I couldn't do `cargo lintcheck --only ryu` 😅

Parses messages with `cargo_metadata`, this catches a few more lints that were ignored because the message had an [expansion field](https://docs.rs/cargo_metadata/latest/cargo_metadata/diagnostic/struct.DiagnosticSpanMacroExpansion.html) that contained a path pointing into `.../.toolchains/...`. It also no longer emits some log lines with `null` as the column

It also merges the `run_clippy_lint` invocations and splits `LintcheckConfig` out into its own file

changelog: none
2022-05-12 23:56:31 +00:00
yonip23
ed3744b957 inline construct_lint_suggestions 2022-05-13 02:20:28 +03:00
Evan Typanski
0def44a1c1 Catch other thinning allocations using Ty 2022-05-12 19:15:08 -04:00
Alex Macleod
8708a261a1 Some lintcheck cleanup 2022-05-12 13:46:58 +01:00
yonip23
dc23b5d661 fix indentation + test 2022-05-12 10:06:15 +03:00
tamaron
9e66f2d058 fix 2022-05-12 12:33:05 +09:00
yonip23
a791205e76 fix clippy warning 2022-05-11 23:16:49 +03:00
bors
a3d1f28849 Auto merge of #8818 - koic:use_rust_2021_prelude, r=flip1995
Use the traits added to the Rust 2021 Edition prelude

Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html

---

changelog: none
2022-05-11 20:16:42 +00:00
yonip23
344888a582 fix review comments 2022-05-11 23:11:52 +03:00
bors
6889d096a9 Auto merge of #8726 - Serial-ATA:issue-8723, r=dswij,xFrednet
Fix `match_single_binding` suggestion for assign expressions

changelog: Fix suggestion for assign expressions in [`match_single_binding`]
closes: #8723
2022-05-11 17:39:25 +00:00
Koichi ITO
ae0216d557 Use the traits added to the Rust 2021 Edition prelude
Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html
2022-05-12 00:38:11 +09:00
Serial
554dc41cea Fix match_single_binding for assign expressions 2022-05-10 18:38:51 -04:00
yonip23
f3e01c4f6a add suggestions to rc_clone_in_vec_init 2022-05-11 01:09:45 +03:00
Evan Typanski
631b4ee7a2 Fix redundant_allocation warning for Rc<Box<str>> 2022-05-10 14:21:51 -04:00
tamaron
1926217b86 chore 2022-05-11 00:27:12 +09:00
tamaron
aaf87c3871 fix 2022-05-10 23:54:42 +09:00
bors
d422baa30c Auto merge of #8796 - nsunderland1:master, r=giraffate
New lint: [`derive_partial_eq_without_eq`]

Introduces a new lint, [`derive_partial_eq_without_eq`].

See: #1781 (doesn't close it though).

changelog: add lint [`derive_partial_eq_without_eq`]
2022-05-10 13:25:27 +00:00
bors
1a11a499d4 Auto merge of #8769 - yonip23:8719, r=xFrednet
introduce rc_clone_in_vec_init lint

Closes #8719

changelog: Introduce [`rc_clone_in_vec_init`] lint
2022-05-10 12:21:12 +00:00
yonip23
feb6d8cf30 introduce rc_clone_in_vec_init lint 2022-05-10 15:10:13 +03:00
nsunderland1
fe84ff3360 New lint: [derive_partial_eq_without_eq] 2022-05-09 22:13:39 -07:00
bors
77effb7bb2 Auto merge of #8809 - Alexendoo:metadata-collection-expect, r=xFrednet
Ignore unfulfilled_lint_expectations in metadata collection

r? `@xFrednet`

When metadata collection is enabled the regular early/late pass registrations are skipped, which the `#[expect()]`s were no fan of: https://github.com/rust-lang/rust-clippy/runs/6356675328?check_suite_focus=true

changelog: none
2022-05-09 19:55:37 +00:00
Alex Macleod
6edf0b4f36 Ignore unfulfilled_lint_expectations in metadata collection 2022-05-09 20:40:37 +01:00
bors
aa033440da Auto merge of #8797 - xFrednet:0000-expect-a-playground, r=flip1995
Replace `#[allow]` with `#[expect]` in Clippy

Hey `@rust-lang/clippy,` `@Alexendoo,` `@dswij,` I'm currently working on the expect attribute as defined in [Rust RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html). With that, an `#[allow]` attribute can be replaced with a `#[expect]` attribute that suppresses the lint, but also emits a warning, if the lint isn't emitted in the expected scope.

With this PR I would like to test the attribute on a project scale and Clippy obviously came to mind. This PR replaces (almost) all `#[allow]` attributes in `clippy_utils` and `clippy_lints` with the `#[expect]` attribute. I was also able to remove some allows since, the related FPs have been fixed 🎉.

My question is now, are there any concerns regarding this? It's still okay to add normal `#[allow]` attributes, I see the need to nit-pick about that in new PRs, unless it's actually a FP. Also, I would not recommend using `#[expect]` in tests, as changes to a lint could the trigger the expect attribute in other files.

Additionally, I've noticed that Clippy has a bunch of `#[allow(clippy::too_many_lines)]` attributes. Should we maybe allow the lint all together or increase the threshold setting? To me, it seems like we mostly just ignore it in our code. 😅 🙃

---

changelog: none

r? `@flip1995` (I've requested you for now, since you're also helping with reviewing the expect implementation. You are welcome to delegate this PR, even if it should be a simple review 🙃 )
2022-05-09 17:14:43 +00:00
Jason Newcomb
993b4016db Don't lint cmp_owned when From::from results in a copy type. 2022-05-09 12:29:31 -04:00
Jason Newcomb
0f1544f15e Reduce unnecessary work in cmp_owned 2022-05-09 11:46:42 -04:00
bors
c3f3c588b0 Auto merge of #8805 - Alexendoo:let-chain-docs, r=flip1995
Recommend let chains over if_chain in docs

Switches over bit_mask.rs to let chains in order to create a nice example

While the rustfmt thing isn't resolved yet, my rust-analyzer isn't a fan of large `if_chains!`s, it stops giving me hover info and such after some number of if statements

changelog: none
2022-05-09 13:56:53 +00:00
Alex Macleod
c9d88ef962 Recommend let chains over if_chain in docs 2022-05-09 14:23:16 +01:00
Alex Macleod
5e4f092291 use let chains in bit_mask.rs 2022-05-09 14:06:46 +01:00