From c65fa3bb53881f8a3b242c0a8db6783bd4d667da Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Sep 2021 05:15:24 -0700 Subject: [PATCH 1/4] Re-enable clippy after upstream crash fix --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60b5974ff..0b82cd99b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,8 +96,7 @@ jobs: clippy: name: Clippy runs-on: ubuntu-latest - #if: github.event_name != 'pull_request' - if: false # Clippy crash: https://github.com/rust-lang/rust-clippy/issues/7423 + if: github.event_name != 'pull_request' steps: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@clippy From 84333be2134b01f46d3946f70d9c39c2823187ea Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Sep 2021 05:18:10 -0700 Subject: [PATCH 2/4] Ignore if_same_then_else clippy lint error: this `if` has identical blocks --> gen/build/src/gen/write.rs:704:33 | 704 | if arg.ty == RustString { | _________________________________^ 705 | | write!(out, "const "); 706 | | } else if let Type::RustVec(_) = arg.ty { | |_________^ | = note: `-D clippy::if-same-then-else` implied by `-D clippy::all` note: same as this --> gen/build/src/gen/write.rs:706:49 | 706 | } else if let Type::RustVec(_) = arg.ty { | _________________________________________________^ 707 | | write!(out, "const "); 708 | | } | |_________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else error: this `if` has identical blocks --> macro/src/expand.rs:430:33 | 430 | if arg.ty == RustString { | _________________________________^ 431 | | quote!(#var #colon *const #ty) 432 | | } else if let Type::RustVec(_) = arg.ty { | |_________^ | = note: `-D clippy::if-same-then-else` implied by `-D clippy::all` note: same as this --> macro/src/expand.rs:432:49 | 432 | } else if let Type::RustVec(_) = arg.ty { | _________________________________________________^ 433 | | quote!(#var #colon *const #ty) 434 | | } else if let Type::Fn(_) = arg.ty { | |_________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else --- gen/build/src/lib.rs | 1 + gen/cmd/src/main.rs | 1 + gen/lib/src/lib.rs | 1 + macro/src/lib.rs | 1 + 4 files changed, 4 insertions(+) diff --git a/gen/build/src/lib.rs b/gen/build/src/lib.rs index 63b2cf63f..b8a463c3a 100644 --- a/gen/build/src/lib.rs +++ b/gen/build/src/lib.rs @@ -51,6 +51,7 @@ clippy::doc_markdown, clippy::drop_copy, clippy::enum_glob_use, + clippy::if_same_then_else, clippy::inherent_to_string, clippy::items_after_statements, clippy::let_underscore_drop, diff --git a/gen/cmd/src/main.rs b/gen/cmd/src/main.rs index f419dad46..1c15db637 100644 --- a/gen/cmd/src/main.rs +++ b/gen/cmd/src/main.rs @@ -3,6 +3,7 @@ clippy::cognitive_complexity, clippy::default_trait_access, clippy::enum_glob_use, + clippy::if_same_then_else, clippy::inherent_to_string, clippy::items_after_statements, clippy::large_enum_variant, diff --git a/gen/lib/src/lib.rs b/gen/lib/src/lib.rs index e3eca5e76..411953b22 100644 --- a/gen/lib/src/lib.rs +++ b/gen/lib/src/lib.rs @@ -12,6 +12,7 @@ clippy::cast_sign_loss, clippy::default_trait_access, clippy::enum_glob_use, + clippy::if_same_then_else, clippy::inherent_to_string, clippy::items_after_statements, clippy::match_bool, diff --git a/macro/src/lib.rs b/macro/src/lib.rs index fe5e6e125..c1251b89c 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -4,6 +4,7 @@ clippy::doc_markdown, clippy::enum_glob_use, clippy::filter_map, + clippy::if_same_then_else, clippy::inherent_to_string, clippy::items_after_statements, clippy::large_enum_variant, From 649da65e444cc9c4de88350458e9e4bcec0c0fef Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Sep 2021 05:19:54 -0700 Subject: [PATCH 3/4] Ignore derivable_impls lint in generated code --- macro/src/derive.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/macro/src/derive.rs b/macro/src/derive.rs index 2f770951f..ea36e3e38 100644 --- a/macro/src/derive.rs +++ b/macro/src/derive.rs @@ -151,6 +151,7 @@ fn struct_default(strct: &Struct, span: Span) -> TokenStream { let fields = strct.fields.iter().map(|field| &field.name.rust); quote_spanned! {span=> + #[allow(clippy::derivable_impls)] // different spans than the derived impl impl #generics ::std::default::Default for #ident #generics { fn default() -> Self { #ident { From 1fae9798050b364eb0d29e542c2fb5aedf57fb40 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Sep 2021 05:20:26 -0700 Subject: [PATCH 4/4] Remove ignore of deleted filter_map clippy lint warning: lint `clippy::filter_map` has been removed: this lint has been replaced by `manual_filter_map`, a more specific lint --> macro/src/lib.rs:6:5 | 6 | clippy::filter_map, | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default --- macro/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/macro/src/lib.rs b/macro/src/lib.rs index c1251b89c..324881d85 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -3,7 +3,6 @@ clippy::default_trait_access, clippy::doc_markdown, clippy::enum_glob_use, - clippy::filter_map, clippy::if_same_then_else, clippy::inherent_to_string, clippy::items_after_statements,