From 49dd6c321dbf1b8c41479f9eb275e5bd3d890aae Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 28 Aug 2024 15:59:31 +0300 Subject: [PATCH] Add `#[allow(unreachable_code)]` to `Display` and `Debug` derives --- impl/src/fmt/debug.rs | 1 + impl/src/fmt/display.rs | 1 + tests/debug.rs | 50 ++++++++++++++++++++++++++++++++++++++ tests/display.rs | 54 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) diff --git a/impl/src/fmt/debug.rs b/impl/src/fmt/debug.rs index a3cee6f2..199b9b0f 100644 --- a/impl/src/fmt/debug.rs +++ b/impl/src/fmt/debug.rs @@ -60,6 +60,7 @@ pub fn expand(input: &syn::DeriveInput, _: &str) -> syn::Result { }; Ok(quote! { + #[allow(unreachable_code)] // omit warnings for `!` and other unreachable types #[automatically_derived] impl #impl_gens derive_more::Debug for #ident #ty_gens #where_clause { #[inline] diff --git a/impl/src/fmt/display.rs b/impl/src/fmt/display.rs index b217a779..41320df5 100644 --- a/impl/src/fmt/display.rs +++ b/impl/src/fmt/display.rs @@ -62,6 +62,7 @@ pub fn expand(input: &syn::DeriveInput, trait_name: &str) -> syn::Result