Commit Graph

16150 Commits

Author SHA1 Message Date
xFrednet
f64efd4d31
Changelog for Rust 1.67 🐞 2023-01-19 22:28:12 +01:00
xFrednet
e3a09eca6d
Update version attribute for 1.67 lints 2023-01-19 21:58:08 +01:00
bors
aa0eb7fb1c Auto merge of #10206 - Niki4tap:one_unsafe_op_per_block, r=Alexendoo
Add `multiple_unsafe_ops_per_block` lint

Adds a lint, which restricts an `unsafe` block to only one unsafe operation.

Closes #10064

---

changelog: New lint: [`multiple_unsafe_ops_per_block`]
[#10206](https://github.com/rust-lang/rust-clippy/pull/10206)
<!-- changelog_checked -->
2023-01-19 13:58:09 +00:00
bors
36e3e26464 Auto merge of #10213 - flip1995:changelog-doc, r=xFrednet
Improve the changelog update documentation

- Make the clippy::version attribute instructions more prominent.
- Mention the beta-accepted label.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog-doc/book/src/development/infrastructure/changelog_update.md)

r? `@xFrednet`

changelog: none
2023-01-19 13:44:48 +00:00
Philipp Krones
d9baced2b5
Improve the changelog update documentation
- Make the clippy::version attribute instructions more prominent.
- Mention the beta-accepted label.
2023-01-19 11:28:35 +01:00
Alex Macleod
11611b0440 Move unchecked_duration_subtraction to pedantic 2023-01-19 11:18:47 +01:00
Michael Woerister
c1b358945a Allow for more efficient sorting when exporting Unord collections. 2023-01-19 10:40:54 +01:00
Michael Woerister
465ed5bd46 Use UnordMap instead of FxHashMap in define_id_collections!(). 2023-01-19 10:40:47 +01:00
Michael Woerister
31a053059e Use UnordSet instead of FxHashSet in define_id_collections!(). 2023-01-19 10:19:07 +01:00
Niki4tap
875e36f7e4 Add multiple_unsafe_ops_per_block lint 2023-01-18 10:00:31 +03:00
Kyle Matsuda
2bfba8685d fix missing subst in clippy utils 2023-01-17 08:55:28 -07:00
Kyle Matsuda
a084d7908c change item_bounds query to return EarlyBinder; remove bound_item_bounds query 2023-01-17 08:55:28 -07:00
Kyle Matsuda
5dac27503f change usages of item_bounds query to bound_item_bounds 2023-01-17 08:55:27 -07:00
bors
89d443a4c3 Auto merge of #10193 - Jarcho:issue_9894, r=Manishearth
Fix suggestion in `transmutes_expressible_as_ptr_casts` when the source type is a borrow.

fixes #9894

changelog: `transmutes_expressible_as_ptr_casts`: Fix suggestion when the source type is a borrow.
2023-01-17 14:58:39 +00:00
bors
07a7603994 Auto merge of #10187 - dswij:issue-10182-semicolon, r=Jarcho
[needless_return]: Remove all semicolons on suggestion

Closes #10182

Multiple semicolons currently breaks autofix for `needless_return` suggestions. Any semicolons left after removing return means that the return type will always be `()`, and thus fail to compile.

This PR allows `needless_return` to remove multiple semicolons.

The change won't cover the case where there is multiple line yet.

i.e.

```rust
fn needless_return() -> bool {
    return true;
;;
}
```

---

changelog: Sugg: [`needless_return`]: Now removes all semicolons on the same line
[#10187](https://github.com/rust-lang/rust-clippy/pull/10187)
<!-- changelog_checked -->
2023-01-15 15:49:40 +00:00
bors
aceb4439d6 Auto merge of #10199 - tylerjw:document-extending-list-configs, r=xFrednet
Document lint configuration values in Clippy's book

changelog: document lint configuration values in Clippy's book

fixes #9991

r? `@xFrednet`
2023-01-14 18:14:31 +00:00
Tyler Weaver
c0da8acb72
Comment that lint_configuration.md is machine generated 2023-01-14 11:10:40 -07:00
bors
483b7ac918 Auto merge of #10038 - xFrednet:9231-sugg-try-from, r=Jarcho
`cast_possible_truncation` Suggest TryFrom when truncation possible

This fixes the last issues from https://github.com/rust-lang/rust-clippy/pull/9664 as the author seems to be inactive. The PR author was sadly kept during the rebase, due to the conflict resolution.

IDK if it's worth it do to a full review, I only added the last commit, everything else remained the same, besides a rebase.

---

changelog: Sugg: [`cast_possible_truncation`]: Now suggests using `try_from` or allowing the lint
[#10038](https://github.com/rust-lang/rust-clippy/pull/10038)
<!-- changelog_checked -->

closes: https://github.com/rust-lang/rust-clippy/issues/9231
2023-01-14 16:04:51 +00:00
bors
91c8ecc5f9 Auto merge of #10201 - MariaSolOs:patch-1, r=dswij
Add missing arguments to `new_lint` example of `cargo` lints

changelog: Add missing arguments to `new_lint` code example.

From the surrounding text, it seems like this code example is missing the arguments to create a new `cargo` lint.
2023-01-14 15:34:17 +00:00
Tyler Weaver
d950279a03
Document generating lint config docs for adding configuration 2023-01-14 07:39:49 -07:00
Tyler Weaver
dc5ce488e7
Move CI tests for collect-metadata to clippy_bors.yml 2023-01-14 07:38:29 -07:00
Kyle Matsuda
b92d90211e change impl_trait_ref query to return EarlyBinder; remove bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata 2023-01-14 00:29:56 -07:00
Kyle Matsuda
a160ce3a48 change usages of impl_trait_ref to bound_impl_trait_ref 2023-01-14 00:23:32 -07:00
Maria José Solano
a7db92574c
Split long line 2023-01-13 18:57:04 -08:00
Tyler Weaver
7d1609dce3
Document configurations in table and paragraphs
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-13 16:26:46 -07:00
Maria José Solano
93f602f1cf
Add missing arguments to cargo lint example 2023-01-13 15:21:49 -08:00
Michael Goulet
93d0f47064 Check ADT fields for copy implementations considering regions 2023-01-13 23:06:29 +00:00
Tyler Weaver
2e2ae68d5a
Document lint configuration values in Clippy's book
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-13 11:48:51 -07:00
Tyler Weaver
d43dce14d5
Remove cognitive-complexity-threshold from docs 2023-01-13 09:01:39 -07:00
bors
efb631a09c Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillot
Feed a bunch of queries instead of tracking fields on TyCtxt

r? `@cjgillot`

pulled out of https://github.com/rust-lang/rust/pull/105462
2023-01-13 13:57:21 +00:00
bors
ac95db69fd Auto merge of #106801 - JohnTitor:rollup-xqkraw0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #106608 (Render missing generics suggestion verbosely)
 - #106716 ([RFC 2397] Deny incorrect locations)
 - #106754 (Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`)
 - #106782 (Ignore tests move in git blame)
 - #106785 (Make blame spans better for impl wfcheck)
 - #106791 (Fix ICE formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-13 10:56:53 +00:00
Yuki Okushi
71b99c48ee Rollup merge of #106608 - compiler-errors:missing-generics-verbose, r=estebank
Render missing generics suggestion verbosely

It's a bit easier to read like this, especially ones that are appending new generics onto an existing list, like ": `, T`" which render somewhat poorly inline.

Also don't suggest `dyn` as a type parameter to add, even if technically that's valid in edition 2015.
2023-01-13 16:54:22 +09:00
bors
83dba6e8bb Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco
Add checks for the signature of the `start` lang item

Closes #105963
2023-01-13 07:45:34 +00:00
bors
97fb130fb2 Auto merge of #10194 - Alexendoo:unchecked-duration-subtraction-pedantic, r=Jarcho
Move `unchecked_duration_subtraction` to pedantic

changelog: [`unchecked_duration_subtraction`]: Move to pedantic

Based on https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202023-01-10/near/320488860
2023-01-13 05:58:46 +00:00
Alex Macleod
295225e9cd Move unchecked_duration_subtraction to pedantic 2023-01-13 00:04:28 +00:00
Michael Goulet
2253646395 Don't suggest dyn as parameter to add 2023-01-12 22:04:30 +00:00
Jason Newcomb
b38848d8f7 Fix suggestion in transmutes_expressible_as_ptr_casts when the source type is a borrow. 2023-01-12 16:01:24 -05:00
Philipp Krones
d21616737b Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup 2023-01-12 19:48:13 +01:00
bors
7f27e2e74e Auto merge of #10192 - Jarcho:revert_9701, r=flip1995
Partially revert #9701

This partially reverts #9701 due to #10134

r? `@flip1995`

changelog: None
2023-01-12 18:47:17 +00:00
Jason Newcomb
757e944ba6 Adjust old code for newer rustc version. 2023-01-12 13:29:23 -05:00
Jason Newcomb
5eed9c69ca Revert 4dbd8ad34e, c7dc961558, ed519ad746 and c6477eb711 2023-01-12 13:28:22 -05:00
bors
0b8ee70084 Auto merge of #10191 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-01-12 18:13:13 +00:00
Philipp Krones
cd76d574e4
Also add rustc_driver to clippy_utils
I'm not sure why this is necessary. It worked without this for me
locally, but this fails in CI. The same was done in clippy_dev
2023-01-12 19:12:06 +01:00
Philipp Krones
616b6d2be1
Bump nightly version -> 2023-01-12 2023-01-12 19:00:16 +01:00
Philipp Krones
631481ffb3
Merge remote-tracking branch 'upstream/master' into rustup 2023-01-12 18:59:59 +01:00
bors
f9ca9d4112 Auto merge of #10149 - jyn514:duplicate-sysroot, r=flip1995
Don't pass `--sysroot` twice if SYSROOT is set

This is useful for rust-lang/rust to allow setting a sysroot that's *only* for build scripts, different from the regular sysroot passed in RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or proc-macros).

That said, the exact motivation is not particularly important: this fixes a regression from
5907e9155e (r1060215684).

Note that only RUSTFLAGS is tested in the new integration test; passing --sysroot through `clippy-driver` never worked as far as I can tell, and no one is using it, so I didn't fix it here.

Helps with https://github.com/rust-lang/rust/pull/106394.

---

changelog: other: `SYSROOT` and `--sysroot` can now be set at the same time
[#10149](https://github.com/rust-lang/rust-clippy/pull/10149)
<!-- changelog_checked -->
2023-01-12 17:36:00 +00:00
Philipp Krones
fe007179ec
Add cargo-clippy sysroot test
Whne SYSROOT is defined, clippy-driver will insert a --sysroot argument
when calling rustc. However, when a sysroot argument is already defined,
e.g. through RUSTFLAGS=--sysroot=... the `cargo clippy` call would
error. This tests that the sysroot argument is only passed once and that
SYSROOT is ignored in this case.
2023-01-12 18:32:47 +01:00
Joshua Nelson
321c530fad
Don't pass --sysroot twice if SYSROOT is set
This is useful for rust-lang/rust to allow setting a sysroot that's
*only* for build scripts, different from the regular sysroot passed in
RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or
proc-macros).

That said, the exact motivation is not particularly important: this
fixes a regression from
5907e9155e (r1060215684).

Note that only RUSTFLAGS is tested in the new integration test; passing
--sysroot through `clippy-driver` never worked as far as I can tell, and
no one is using it, so I didn't fix it here.
2023-01-12 18:32:47 +01:00
Oli Scherer
0c48b5a223 Feed the features_query instead of grabbing it from the session lazily 2023-01-12 17:14:17 +00:00
bors
decaba97cc Auto merge of #10184 - robertbastian:master, r=xFrednet
Allow implementing `Hash` with derived `PartialEq` (`derive_hash_xor_eq`

This is a common pattern and is totally allowed by the `Hash` trait.

Fixes #2627

changelog: Move: Renamed `derive_hash_xor_eq` to [`derived_hash_with_manual_eq`]
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
changelog: Enhancement: [`derived_hash_with_manual_eq`]: Now allows `#[derive(PartialEq)]` with custom `Hash` implementations
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
<!-- changelog_checked -->
2023-01-12 14:59:41 +00:00