Skip to content

Clippy subtree sync #117979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 84 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a799249
Add additional branches to hir_utils::eq_expr
Oct 24, 2023
ed982af
Expliticly specify else branches in hir_utils::hash_expr
Oct 30, 2023
67d379b
Reorder ExprKinds in eq_expr to alphabetical
Oct 30, 2023
6d84065
Add branches in eq_expr
Oct 31, 2023
57a4644
Fix `dbg_macro` semi span calculation
Alexendoo Nov 1, 2023
aae86cc
Rename hook.
cjgillot Oct 31, 2023
e1ec2d5
Minimize `pub` usage in `source_map.rs`.
nnethercote Nov 2, 2023
77c1e3a
Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup
flip1995 Nov 2, 2023
902c79c
Auto merge of #11743 - Alexendoo:dbg-macro-stmt-span, r=xFrednet
bors Nov 2, 2023
2d9af16
Auto merge of #117507 - nnethercote:rustc_span, r=Nilstrieb
bors Nov 3, 2023
294df80
[`unused_enumerate_index`]: don't ICE on empty tuples
y21 Nov 3, 2023
789bc73
Auto merge of #11756 - y21:issue11755, r=Manishearth
bors Nov 3, 2023
b9efa3e
update references of `clippy_utils::msrvs` and `clippy_lints::util::c…
y21 Nov 4, 2023
17c7d21
Warn when lint level is set on a match arm
Nadrieril Oct 23, 2023
67cc4b0
fix clippy author and failing test
dnbln Nov 4, 2023
6d9516a
Auto merge of #11758 - y21:clippy_config_references, r=flip1995
bors Nov 6, 2023
171845d
Reorder ExprKinds in hash_expr alphabetically
Nov 6, 2023
ba43632
Auto merge of #11736 - gernot-ohner:issue-10267, r=flip1995
bors Nov 8, 2023
73b9841
remove unnecessary `find_map` calls
Jacherr Nov 8, 2023
3a91a11
add logic to check allocator matching
Jacherr Nov 8, 2023
399fe32
[arc_with_non_send_sync] Improve suggested resolution
PartiallyUntyped Nov 7, 2023
7932560
update testcases, cleanup
Jacherr Nov 8, 2023
e16d42f
Auto merge of #11772 - partiallytyped:11714, r=blyxyas
bors Nov 8, 2023
67bb503
add support for std::alloc::Global, add more tests
Jacherr Nov 8, 2023
b6d56c4
add no-rustfix since suggestions are invalid
Jacherr Nov 8, 2023
483b109
cargo dev fmt
Jacherr Nov 8, 2023
7e716ff
[`mod_module_files`] Don't emit lint for modules in tests
PartiallyUntyped Nov 8, 2023
7cdaa3b
replace incorrect bool
Jacherr Nov 8, 2023
34b7d15
Auto merge of #11779 - partiallytyped:11775, r=blyxyas
bors Nov 8, 2023
16d58a2
Lift `expr_diverges` to `clippy_utils` as `is_never_expr`
Jarcho Nov 7, 2023
a44bb07
Change divergence checking to match the compiler's type system based …
Jarcho Nov 9, 2023
eabc64f
add additonal non-trigger testcase
Jacherr Nov 9, 2023
6be0f74
Auto merge of #11780 - Jacherr:vec-allocator-nolint, r=xFrednet
bors Nov 9, 2023
9681b4a
Run `if-to-let-chain clippy*/**/*.rs`
Alexendoo Nov 10, 2023
13b4bb1
Clean up after if chain removal
Alexendoo Nov 2, 2023
9a4dd10
Auto merge of #11750 - Alexendoo:let-chains, r=flip1995
bors Nov 10, 2023
f1979d4
Destructure `Conf` in `register_lints`
Alexendoo Nov 10, 2023
cb90674
add iter_over_hash_type lint
Jacherr Nov 11, 2023
7bc39f3
format and fix examples
Jacherr Nov 11, 2023
4a0c36d
Auto merge of #11790 - Alexendoo:destructure-conf, r=Manishearth
bors Nov 11, 2023
b2cf8f7
[`map_identity`]: respect match ergonomics
y21 Nov 11, 2023
d487579
Auto merge of #11792 - y21:issue11764, r=llogiq
bors Nov 11, 2023
a68cd88
Lint `needless_borrow` on most union field accesses
Jarcho Sep 14, 2023
4dead77
add type details to unnecessary_fallible_conversions note
matthri Nov 7, 2023
1a01132
Lint `explicit_auto_deref` on most union field accesses.
Jarcho Sep 15, 2023
9411648
implement more types to lint, fix wording
Jacherr Nov 11, 2023
938984a
run cargo dev fmt
Jacherr Nov 11, 2023
8ee9a9c
Auto merge of #11767 - matthri:unnecessary-fallible-conversions-ext-n…
bors Nov 11, 2023
886d5fb
Auto merge of #11508 - Jarcho:issue_11474, r=blyxyas
bors Nov 12, 2023
6a15f3b
Auto merge of #11787 - Jarcho:divergence_check, r=dswij
bors Nov 12, 2023
661e91b
Add test
compiler-errors Nov 5, 2023
1539eb8
Don't check for late-bound vars, check for escaping bound vars
compiler-errors Nov 5, 2023
07bc130
Auto merge of #11760 - compiler-errors:escaping, r=Jarcho
bors Nov 12, 2023
d89890d
move `suspicious_doc_comments` to doc pass
y21 Nov 13, 2023
a4b2864
Auto merge of #11798 - y21:move_sus_doc_comments, r=flip1995
bors Nov 13, 2023
c4971f9
rename `ReLateBound` to `ReBound`
lcnr Nov 13, 2023
9ab054d
update type flags
lcnr Nov 13, 2023
5a85822
Remove Centri3 from reviewer rotation
blyxyas Nov 13, 2023
f8ea496
add tests for type-aliased hash types
Jacherr Nov 13, 2023
c3a6b37
Auto merge of #11800 - blyxyas:meow-meow, r=Centri3
bors Nov 13, 2023
48f38eb
`needless_return_with_question_mark` ignore let-else
dswij Nov 13, 2023
3f6b29a
[`impl_trait_in_params`]: fix span calculation
y21 Nov 14, 2023
a9d42e6
fix: reduce [`manual_memcpy`] indexing when array length is same to l…
granddaifuku Nov 8, 2023
9aa2330
finish `RegionKind` rename
lcnr Nov 14, 2023
ca8f33e
Auto merge of #11778 - granddaifuku:fix/reduce-indexing-manual_memcpy…
bors Nov 14, 2023
0c42e45
Auto merge of #11791 - Jacherr:iter_over_hash_type, r=Jarcho
bors Nov 14, 2023
9401cf2
Update version attribute for 1.74 lints
xFrednet Nov 14, 2023
cab975c
Changelog for Rust 1.74 :jack_o_lantern:
xFrednet Nov 14, 2023
b3073c5
Change `if_same_then_else` to be a `style` lint
hrxi Nov 14, 2023
a86a570
replace lint with `span_lint_and_then`
Jacherr Nov 15, 2023
11881be
also move `module_style` to `span_lint_x` functions
Jacherr Nov 15, 2023
abf01e4
Auto merge of #11810 - Jacherr:cast-possible-wrap-link, r=Manishearth
bors Nov 15, 2023
19eec0b
disallow `struct_span_lint`
y21 Nov 15, 2023
783b914
Auto merge of #11804 - y21:issue-11803, r=dswij
bors Nov 15, 2023
662ea3f
Auto merge of #11811 - y21:avoid_cx_struct_span_lint, r=Manishearth
bors Nov 15, 2023
7ad3373
Auto merge of #11802 - dswij:issue-11765, r=xFrednet
bors Nov 15, 2023
3ea5bcf
Auto merge of #11809 - hrxi:pr_if_same_then_else_style, r=Alexendoo
bors Nov 15, 2023
406d953
Auto merge of #11806 - xFrednet:changelog-1-74, r=Alexendoo
bors Nov 15, 2023
6fab148
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 16, 2023
887f5a5
Bump nightly version -> 2023-11-16
flip1995 Nov 16, 2023
6f952fb
Bump Clippy version -> 0.1.76
flip1995 Nov 16, 2023
edb720b
Auto merge of #11823 - flip1995:rustup, r=flip1995
bors Nov 16, 2023
75bdfad
Merge commit 'edb720b199083f4107b858a8761648065bf38d86' into clippyup
flip1995 Nov 16, 2023
2ac2b26
Update Cargo.lock
flip1995 Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 5 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"

[[package]]
name = "clippy"
version = "0.1.75"
version = "0.1.76"
dependencies = [
"anstream",
"clippy_config",
Expand Down Expand Up @@ -581,7 +581,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.75"
version = "0.1.76"
dependencies = [
"rustc-semver",
"serde",
Expand All @@ -604,14 +604,13 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.75"
version = "0.1.76"
dependencies = [
"arrayvec",
"cargo_metadata 0.15.4",
"clippy_config",
"clippy_utils",
"declare_clippy_lint",
"if_chain",
"itertools",
"quine-mc_cluskey",
"regex",
Expand All @@ -630,11 +629,10 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.75"
version = "0.1.76"
dependencies = [
"arrayvec",
"clippy_config",
"if_chain",
"itertools",
"rustc-semver",
]
Expand Down Expand Up @@ -1016,7 +1014,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"

[[package]]
name = "declare_clippy_lint"
version = "0.1.75"
version = "0.1.76"
dependencies = [
"itertools",
"quote",
Expand Down
64 changes: 62 additions & 2 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,70 @@ document.

## Unreleased / Beta / In Rust Nightly

[1e8fdf49...master](https://github.com/rust-lang/rust-clippy/compare/1e8fdf49...master)
[7671c283...master](https://github.com/rust-lang/rust-clippy/compare/7671c283...master)

## Rust 1.74

Current stable, released 2023-11-16

[View all 94 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-08-11T15%3A29%3A18Z..2023-09-25T08%3A48%3A22Z+base%3Amaster)

### New Lints

* [`redundant_as_str`]
[#11526](https://github.com/rust-lang/rust-clippy/pull/11526)
* [`needless_borrows_for_generic_args`]
[#11511](https://github.com/rust-lang/rust-clippy/pull/11511)
* [`path_ends_with_ext`]
[#11483](https://github.com/rust-lang/rust-clippy/pull/11483)
* [`unnecessary_map_on_constructor`]
[#11413](https://github.com/rust-lang/rust-clippy/pull/11413)
* [`missing_asserts_for_indexing`]
[#10692](https://github.com/rust-lang/rust-clippy/pull/10692)
* [`iter_out_of_bounds`]
[#11396](https://github.com/rust-lang/rust-clippy/pull/11396)
* [`implied_bounds_in_impls`]
[#11362](https://github.com/rust-lang/rust-clippy/pull/11362)
* [`reserve_after_initialization`]
[#11373](https://github.com/rust-lang/rust-clippy/pull/11373)
* [`should_panic_without_expect`]
[#11204](https://github.com/rust-lang/rust-clippy/pull/11204)

### Moves and Deprecations

* Renamed `incorrect_clone_impl_on_copy_type` to [`non_canonical_clone_impl`]
[#11358](https://github.com/rust-lang/rust-clippy/pull/11358)
* Renamed `incorrect_partial_ord_impl_on_ord_type` to [`non_canonical_partial_ord_impl`]
[#11358](https://github.com/rust-lang/rust-clippy/pull/11358)
* Moved [`non_canonical_clone_impl`] to `suspicious` (Now warn-by-default)
[#11358](https://github.com/rust-lang/rust-clippy/pull/11358)
* Moved [`non_canonical_partial_ord_impl`] to `suspicious` (Now warn-by-default)
[#11358](https://github.com/rust-lang/rust-clippy/pull/11358)
* Moved [`needless_pass_by_ref_mut`] to `nursery` (Now allow-by-default)
[#11596](https://github.com/rust-lang/rust-clippy/pull/11596)

### Enhancements

* [`undocumented_unsafe_blocks`]: The config values [`accept-comment-above-statement`] and
[`accept-comment-above-attributes`] to `true` by default
[#11170](https://github.com/rust-lang/rust-clippy/pull/11170)
* [`explicit_iter_loop`]: Added [`enforce-iter-loop-reborrow`] to disable reborrow linting by default
[#11418](https://github.com/rust-lang/rust-clippy/pull/11418)

### ICE Fixes

* [`enum_variant_names`]: No longer crashes if the threshold is 0 and the enum has no variants
[#11552](https://github.com/rust-lang/rust-clippy/pull/11552)
* [`cast_possible_truncation`]: No longer crashes on values larger than `u64::MAX`
[#11517](https://github.com/rust-lang/rust-clippy/pull/11517)
* [`tuple_array_conversions`]: No longer crashes if the array length is not usize
[#11379](https://github.com/rust-lang/rust-clippy/pull/11379)
* [`useless_conversion`]: No longer crashes, when the receiver is a non-fn item
[#11070](https://github.com/rust-lang/rust-clippy/pull/11070)

## Rust 1.73

Current stable, released 2023-10-05
Released 2023-10-05

[View all 103 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-07-02T12%3A24%3A40Z..2023-08-11T11%3A09%3A56Z+base%3Amaster)

Expand Down Expand Up @@ -5123,6 +5182,7 @@ Released 2018-09-13
[`iter_on_empty_collections`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_on_empty_collections
[`iter_on_single_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_on_single_items
[`iter_out_of_bounds`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_out_of_bounds
[`iter_over_hash_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_over_hash_type
[`iter_overeager_cloned`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned
[`iter_skip_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next
[`iter_skip_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_zero
Expand Down
8 changes: 1 addition & 7 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,10 @@ For example, the [`else_if_without_else`][else_if_without_else] lint is register
pub mod else_if_without_else;
// ...

pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
// ...
store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse));
// ...

store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
// ...
LintId::of(&else_if_without_else::ELSE_IF_WITHOUT_ELSE),
// ...
]);
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.75"
version = "0.1.76"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
12 changes: 6 additions & 6 deletions src/tools/clippy/book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ When using `cargo dev new_lint`, the lint is automatically registered and
nothing more has to be done.

When declaring a new lint by hand and `cargo dev update_lints` is used, the lint
pass may have to be registered manually in the `register_plugins` function in
pass may have to be registered manually in the `register_lints` function in
`clippy_lints/src/lib.rs`:

```rust,ignore
Expand Down Expand Up @@ -436,7 +436,7 @@ need to ensure that the MSRV configured for the project is >= the MSRV of the
required Rust feature. If multiple features are required, just use the one with
a lower MSRV.

First, add an MSRV alias for the required feature in [`clippy_utils::msrvs`].
First, add an MSRV alias for the required feature in [`clippy_config::msrvs`].
This can be accessed later as `msrvs::STR_STRIP_PREFIX`, for example.

```rust
Expand Down Expand Up @@ -506,7 +506,7 @@ fn msrv_1_45() {
```

As a last step, the lint should be added to the lint documentation. This is done
in `clippy_lints/src/utils/conf.rs`:
in `clippy_config/src/conf.rs`:

```rust
define_Conf! {
Expand All @@ -516,7 +516,7 @@ define_Conf! {
}
```

[`clippy_utils::msrvs`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/msrvs/index.html
[`clippy_config::msrvs`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_config/msrvs/index.html

## Author lint

Expand Down Expand Up @@ -657,7 +657,7 @@ Adding a configuration to a lint can be useful for
thresholds or to constrain some behavior that can be seen as a false positive
for some users. Adding a configuration is done in the following steps:

1. Adding a new configuration entry to [`clippy_lints::utils::conf`] like this:
1. Adding a new configuration entry to [`clippy_config::conf`] like this:

```rust,ignore
/// Lint: LINT_NAME.
Expand Down Expand Up @@ -736,7 +736,7 @@ for some users. Adding a configuration is done in the following steps:

Run `cargo collect-metadata` to generate documentation changes for the book.

[`clippy_lints::utils::conf`]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/utils/conf.rs
[`clippy_config::conf`]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_config/src/conf.rs
[`clippy_lints` lib file]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/lib.rs
[`tests/ui`]: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui
[`tests/ui-toml`]: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui-toml
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/defining_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ However, sometimes we might want to declare a new lint by hand. In this case,
we'd use `cargo dev update_lints` command afterwards.

When a lint is manually declared, we might need to register the lint pass
manually in the `register_plugins` function in `clippy_lints/src/lib.rs`:
manually in the `register_lints` function in `clippy_lints/src/lib.rs`:

```rust
store.register_late_pass(|_| Box::new(foo_functions::FooFunctions));
Expand Down
6 changes: 6 additions & 0 deletions src/tools/clippy/clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
avoid-breaking-exported-api = false

# use the various `span_lint_*` methods instead, which also add a link to the docs
disallowed-methods = [
"rustc_lint::context::LintContext::struct_span_lint",
"rustc_middle::ty::context::TyCtxt::struct_span_lint_hir"
]
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.75"
version = "0.1.76"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
24 changes: 5 additions & 19 deletions src/tools/clippy/clippy_config/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::de::{self, Deserializer, Visitor};
use serde::{ser, Deserialize, Serialize};
use std::fmt;
use std::hash::{Hash, Hasher};

#[derive(Clone, Debug, Deserialize)]
pub struct Rename {
Expand Down Expand Up @@ -33,32 +32,19 @@ impl DisallowedPath {
}
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub enum MatchLintBehaviour {
AllTypes,
WellKnownTypes,
Never,
}

#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct MacroMatcher {
pub name: String,
pub braces: (String, String),
pub braces: (char, char),
}

impl Hash for MacroMatcher {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name.hash(state);
}
}

impl PartialEq for MacroMatcher {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
}
}
impl Eq for MacroMatcher {}

impl<'de> Deserialize<'de> for MacroMatcher {
fn deserialize<D>(deser: D) -> Result<Self, D::Error>
where
Expand All @@ -83,7 +69,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
V: de::MapAccess<'de>,
{
let mut name = None;
let mut brace: Option<String> = None;
let mut brace: Option<char> = None;
while let Some(key) = map.next_key()? {
match key {
Field::Name => {
Expand All @@ -104,7 +90,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
let brace = brace.ok_or_else(|| de::Error::missing_field("brace"))?;
Ok(MacroMatcher {
name,
braces: [("(", ")"), ("{", "}"), ("[", "]")]
braces: [('(', ')'), ('{', '}'), ('[', ']')]
.into_iter()
.find(|b| b.0 == brace)
.map(|(o, c)| (o.to_owned(), c.to_owned()))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
extract_msrv_attr!({context_import});
}}

// TODO: Add MSRV level to `clippy_utils/src/msrvs.rs` if needed.
// TODO: Update msrv config comment in `clippy_lints/src/utils/conf.rs`
// TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed.
// TODO: Update msrv config comment in `clippy_config/src/conf.rs`
"#
)
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.75"
version = "0.1.76"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -14,7 +14,6 @@ cargo_metadata = "0.15.3"
clippy_config = { path = "../clippy_config" }
clippy_utils = { path = "../clippy_utils" }
declare_clippy_lint = { path = "../declare_clippy_lint" }
if_chain = "1.0"
itertools = "0.10.1"
quine-mc_cluskey = "0.2"
regex-syntax = "0.7"
Expand Down
34 changes: 16 additions & 18 deletions src/tools/clippy/clippy_lints/src/allow_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,22 @@ declare_lint_pass!(AllowAttribute => [ALLOW_ATTRIBUTES]);
impl LateLintPass<'_> for AllowAttribute {
// Separate each crate's features.
fn check_attribute<'cx>(&mut self, cx: &LateContext<'cx>, attr: &'cx Attribute) {
if_chain! {
if !in_external_macro(cx.sess(), attr.span);
if cx.tcx.features().lint_reasons;
if let AttrStyle::Outer = attr.style;
if let Some(ident) = attr.ident();
if ident.name == rustc_span::symbol::sym::allow;
if !is_from_proc_macro(cx, &attr);
then {
span_lint_and_sugg(
cx,
ALLOW_ATTRIBUTES,
ident.span,
"#[allow] attribute found",
"replace it with",
"expect".into(),
Applicability::MachineApplicable,
);
}
if !in_external_macro(cx.sess(), attr.span)
&& cx.tcx.features().lint_reasons
&& let AttrStyle::Outer = attr.style
&& let Some(ident) = attr.ident()
&& ident.name == rustc_span::symbol::sym::allow
&& !is_from_proc_macro(cx, &attr)
{
span_lint_and_sugg(
cx,
ALLOW_ATTRIBUTES,
ident.span,
"#[allow] attribute found",
"replace it with",
"expect".into(),
Applicability::MachineApplicable,
);
}
}
}
Loading