Skip to content

Commit d66f38d

Browse files
committed
Auto merge of #120806 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update r? `@Manishearth`
2 parents f4cfd87 + 4ec9eec commit d66f38d

File tree

132 files changed

+3874
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3874
-609
lines changed

Cargo.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
556556

557557
[[package]]
558558
name = "clippy"
559-
version = "0.1.77"
559+
version = "0.1.78"
560560
dependencies = [
561561
"anstream",
562562
"clippy_config",
@@ -584,7 +584,7 @@ dependencies = [
584584

585585
[[package]]
586586
name = "clippy_config"
587-
version = "0.1.77"
587+
version = "0.1.78"
588588
dependencies = [
589589
"rustc-semver",
590590
"serde",
@@ -607,7 +607,7 @@ dependencies = [
607607

608608
[[package]]
609609
name = "clippy_lints"
610-
version = "0.1.77"
610+
version = "0.1.78"
611611
dependencies = [
612612
"arrayvec",
613613
"cargo_metadata 0.18.0",
@@ -632,7 +632,7 @@ dependencies = [
632632

633633
[[package]]
634634
name = "clippy_utils"
635-
version = "0.1.77"
635+
version = "0.1.78"
636636
dependencies = [
637637
"arrayvec",
638638
"clippy_config",
@@ -1003,7 +1003,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
10031003

10041004
[[package]]
10051005
name = "declare_clippy_lint"
1006-
version = "0.1.77"
1006+
version = "0.1.78"
10071007
dependencies = [
10081008
"itertools",
10091009
"quote",

src/tools/clippy/.github/driver.sh

100644100755
+15
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ if [[ ${OS} == "Windows" ]]; then
1111
else
1212
desired_sysroot=/tmp
1313
fi
14+
# Set --sysroot in command line
1415
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
1516
test "$sysroot" = $desired_sysroot
1617

18+
# Set --sysroot in arg_file.txt and pass @arg_file.txt to command line
19+
echo "--sysroot=$desired_sysroot" > arg_file.txt
20+
sysroot=$(./target/debug/clippy-driver @arg_file.txt --print sysroot)
21+
test "$sysroot" = $desired_sysroot
22+
23+
# Setting SYSROOT in command line
1724
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
1825
test "$sysroot" = $desired_sysroot
1926

@@ -24,6 +31,14 @@ test "$sysroot" = $desired_sysroot
2431
SYSROOT=/tmp RUSTFLAGS="--sysroot=$(rustc --print sysroot)" ../target/debug/cargo-clippy clippy --verbose
2532
)
2633

34+
# Check that the --sysroot argument is only passed once via arg_file.txt (SYSROOT is ignored)
35+
(
36+
echo "fn main() {}" > target/driver_test.rs
37+
echo "--sysroot="$(./target/debug/clippy-driver --print sysroot)"" > arg_file.txt
38+
echo "--verbose" >> arg_file.txt
39+
SYSROOT=/tmp ./target/debug/clippy-driver @arg_file.txt ./target/driver_test.rs
40+
)
41+
2742
# Make sure this isn't set - clippy-driver should cope without it
2843
unset CARGO_MANIFEST_DIR
2944

src/tools/clippy/CHANGELOG.md

+64-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,65 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[09ac14c9...master](https://github.com/rust-lang/rust-clippy/compare/09ac14c9...master)
9+
[a859e5cc...master](https://github.com/rust-lang/rust-clippy/compare/a859e5cc...master)
10+
11+
## Rust 1.76
12+
13+
Current stable, released 2024-02-08
14+
15+
[View all 85 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-11-02T20%3A23%3A40Z..2023-12-16T13%3A11%3A08Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
- [`infinite_loop`]
20+
[#11829](https://github.com/rust-lang/rust-clippy/pull/11829)
21+
- [`ineffective_open_options`]
22+
[#11902](https://github.com/rust-lang/rust-clippy/pull/11902)
23+
- [`uninhabited_references`]
24+
[#11878](https://github.com/rust-lang/rust-clippy/pull/11878)
25+
- [`repeat_vec_with_capacity`]
26+
[#11597](https://github.com/rust-lang/rust-clippy/pull/11597)
27+
- [`test_attr_in_doctest`]
28+
[#11872](https://github.com/rust-lang/rust-clippy/pull/11872)
29+
- [`option_map_or_err_ok`]
30+
[#11864](https://github.com/rust-lang/rust-clippy/pull/11864)
31+
- [`join_absolute_paths`]
32+
[#11453](https://github.com/rust-lang/rust-clippy/pull/11453)
33+
- [`impl_hash_borrow_with_str_and_bytes`]
34+
[#11781](https://github.com/rust-lang/rust-clippy/pull/11781)
35+
- [`iter_over_hash_type`]
36+
[#11791](https://github.com/rust-lang/rust-clippy/pull/11791)
37+
38+
### Moves and Deprecations
39+
40+
- Renamed `blocks_in_if_conditions` to [`blocks_in_conditions`]
41+
[#11853](https://github.com/rust-lang/rust-clippy/pull/11853)
42+
- Moved [`implied_bounds_in_impls`] to `complexity` (Now warn-by-default)
43+
[#11867](https://github.com/rust-lang/rust-clippy/pull/11867)
44+
- Moved [`if_same_then_else`] to `style` (Now warn-by-default)
45+
[#11809](https://github.com/rust-lang/rust-clippy/pull/11809)
46+
47+
### Enhancements
48+
49+
- [`missing_safety_doc`], [`unnecessary_safety_doc`], [`missing_panics_doc`], [`missing_errors_doc`]:
50+
Added the [`check-private-items`] configuration to enable lints on private items
51+
[#11842](https://github.com/rust-lang/rust-clippy/pull/11842)
52+
53+
### ICE Fixes
54+
55+
- [`impl_trait_in_params`]: No longer crashes when a function has generics but no function parameters
56+
[#11804](https://github.com/rust-lang/rust-clippy/pull/11804)
57+
- [`unused_enumerate_index`]: No longer crashes on empty tuples
58+
[#11756](https://github.com/rust-lang/rust-clippy/pull/11756)
59+
60+
### Others
61+
62+
- Clippy now respects the `CARGO` environment value
63+
[#11944](https://github.com/rust-lang/rust-clippy/pull/11944)
1064

1165
## Rust 1.75
1266

13-
Current stable, released 2023-12-28
67+
Released 2023-12-28
1468

1569
[View all 69 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-09-25T11%3A47%3A47Z..2023-11-02T16%3A41%3A59Z+base%3Amaster)
1670

@@ -5198,6 +5252,7 @@ Released 2018-09-13
51985252
[`implied_bounds_in_impls`]: https://rust-lang.github.io/rust-clippy/master/index.html#implied_bounds_in_impls
51995253
[`impossible_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#impossible_comparisons
52005254
[`imprecise_flops`]: https://rust-lang.github.io/rust-clippy/master/index.html#imprecise_flops
5255+
[`incompatible_msrv`]: https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
52015256
[`inconsistent_digit_grouping`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
52025257
[`inconsistent_struct_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor
52035258
[`incorrect_clone_impl_on_copy_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
@@ -5276,6 +5331,7 @@ Released 2018-09-13
52765331
[`let_with_type_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_with_type_underscore
52775332
[`lines_filter_map_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
52785333
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
5334+
[`lint_groups_priority`]: https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
52795335
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
52805336
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
52815337
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
@@ -5284,6 +5340,7 @@ Released 2018-09-13
52845340
[`manual_assert`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
52855341
[`manual_async_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
52865342
[`manual_bits`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits
5343+
[`manual_c_str_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals
52875344
[`manual_clamp`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp
52885345
[`manual_filter`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter
52895346
[`manual_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter_map
@@ -5523,6 +5580,7 @@ Released 2018-09-13
55235580
[`redundant_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
55245581
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
55255582
[`redundant_type_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations
5583+
[`ref_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr
55265584
[`ref_binding_to_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_binding_to_reference
55275585
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
55285586
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
@@ -5622,6 +5680,7 @@ Released 2018-09-13
56225680
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
56235681
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
56245682
[`to_string_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
5683+
[`to_string_trait_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
56255684
[`todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
56265685
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
56275686
[`too_many_lines`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
@@ -5677,6 +5736,7 @@ Released 2018-09-13
56775736
[`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
56785737
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
56795738
[`unnecessary_owned_empty_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_strings
5739+
[`unnecessary_result_map_or_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_result_map_or_else
56805740
[`unnecessary_safety_comment`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_comment
56815741
[`unnecessary_safety_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_doc
56825742
[`unnecessary_self_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_self_imports
@@ -5819,4 +5879,6 @@ Released 2018-09-13
58195879
[`enforce-iter-loop-reborrow`]: https://doc.rust-lang.org/clippy/lint_configuration.html#enforce-iter-loop-reborrow
58205880
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
58215881
[`pub-underscore-fields-behavior`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pub-underscore-fields-behavior
5882+
[`allow-comparison-to-zero`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-comparison-to-zero
5883+
[`allowed-wildcard-imports`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-wildcard-imports
58225884
<!-- end autogenerated links to configuration documentation -->

src/tools/clippy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.77"
3+
version = "0.1.78"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

src/tools/clippy/book/src/lint_configuration.md

+33
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
151151
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
152152
* [`manual_hash_one`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one)
153153
* [`iter_kv_map`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
154+
* [`manual_c_str_literals`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals)
154155

155156

156157
## `cognitive-complexity-threshold`
@@ -828,3 +829,35 @@ exported visibility, or whether they are marked as "pub".
828829
* [`pub_underscore_fields`](https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields)
829830

830831

832+
## `allow-comparison-to-zero`
833+
Don't lint when comparing the result of a modulo operation to zero.
834+
835+
**Default Value:** `true`
836+
837+
---
838+
**Affected lints:**
839+
* [`modulo_arithmetic`](https://rust-lang.github.io/rust-clippy/master/index.html#modulo_arithmetic)
840+
841+
842+
## `allowed-wildcard-imports`
843+
List of path segments allowed to have wildcard imports.
844+
845+
#### Example
846+
847+
```toml
848+
allowed-wildcard-imports = [ "utils", "common" ]
849+
```
850+
851+
#### Noteworthy
852+
853+
1. This configuration has no effects if used with `warn_on_all_wildcard_imports = true`.
854+
2. Paths with any segment that containing the word 'prelude'
855+
are already allowed by default.
856+
857+
**Default Value:** `[]`
858+
859+
---
860+
**Affected lints:**
861+
* [`wildcard_imports`](https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports)
862+
863+

src/tools/clippy/clippy_config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.77"
3+
version = "0.1.78"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/tools/clippy/clippy_config/src/conf.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ define_Conf! {
260260
///
261261
/// Suppress lints whenever the suggested change would cause breakage for other crates.
262262
(avoid_breaking_exported_api: bool = true),
263-
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP.
263+
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS.
264264
///
265265
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
266266
#[default_text = ""]
@@ -567,6 +567,26 @@ define_Conf! {
567567
/// Lint "public" fields in a struct that are prefixed with an underscore based on their
568568
/// exported visibility, or whether they are marked as "pub".
569569
(pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PubliclyExported),
570+
/// Lint: MODULO_ARITHMETIC.
571+
///
572+
/// Don't lint when comparing the result of a modulo operation to zero.
573+
(allow_comparison_to_zero: bool = true),
574+
/// Lint: WILDCARD_IMPORTS.
575+
///
576+
/// List of path segments allowed to have wildcard imports.
577+
///
578+
/// #### Example
579+
///
580+
/// ```toml
581+
/// allowed-wildcard-imports = [ "utils", "common" ]
582+
/// ```
583+
///
584+
/// #### Noteworthy
585+
///
586+
/// 1. This configuration has no effects if used with `warn_on_all_wildcard_imports = true`.
587+
/// 2. Paths with any segment that containing the word 'prelude'
588+
/// are already allowed by default.
589+
(allowed_wildcard_imports: FxHashSet<String> = FxHashSet::default()),
570590
}
571591

572592
/// Search for the configuration file.

src/tools/clippy/clippy_config/src/msrvs.rs

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rustc_semver::RustcVersion;
33
use rustc_session::Session;
44
use rustc_span::{sym, Symbol};
55
use serde::Deserialize;
6+
use std::fmt;
67

78
macro_rules! msrv_aliases {
89
($($major:literal,$minor:literal,$patch:literal {
@@ -16,6 +17,8 @@ macro_rules! msrv_aliases {
1617

1718
// names may refer to stabilized feature flags or library items
1819
msrv_aliases! {
20+
1,77,0 { C_STR_LITERALS }
21+
1,76,0 { PTR_FROM_REF }
1922
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
2023
1,70,0 { OPTION_RESULT_IS_VARIANT_AND, BINARY_HEAP_RETAIN }
2124
1,68,0 { PATH_MAIN_SEPARATOR_STR }
@@ -58,6 +61,16 @@ pub struct Msrv {
5861
stack: Vec<RustcVersion>,
5962
}
6063

64+
impl fmt::Display for Msrv {
65+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
66+
if let Some(msrv) = self.current() {
67+
write!(f, "{msrv}")
68+
} else {
69+
f.write_str("1.0.0")
70+
}
71+
}
72+
}
73+
6174
impl<'de> Deserialize<'de> for Msrv {
6275
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6376
where

src/tools/clippy/clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.77"
3+
version = "0.1.78"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

src/tools/clippy/clippy_lints/src/booleans.rs

+1
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ struct NotSimplificationVisitor<'a, 'tcx> {
499499
impl<'a, 'tcx> Visitor<'tcx> for NotSimplificationVisitor<'a, 'tcx> {
500500
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
501501
if let ExprKind::Unary(UnOp::Not, inner) = &expr.kind
502+
&& !expr.span.from_expansion()
502503
&& !inner.span.from_expansion()
503504
&& let Some(suggestion) = simplify_not(self.cx, inner)
504505
&& self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, expr.hir_id).0 != Level::Allow

0 commit comments

Comments
 (0)