From f2f4826ec32236a299a91628b0ec51c506c10349 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 3 Jan 2024 18:23:09 -0800 Subject: [PATCH] Pick up changes to non_exhaustive_omitted_patterns lint warning: the lint level must be set on the whole match --> impl/src/lib.rs:31:9 | 30 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 31 | _ => unsupported(lit), | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 23 | let expanded = #[deny(non_exhaustive_omitted_patterns)] | ++++++++++++++++++++++++++++++++++++++++ --- impl/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impl/src/lib.rs b/impl/src/lib.rs index f0f3f15..564c4fb 100644 --- a/impl/src/lib.rs +++ b/impl/src/lib.rs @@ -20,6 +20,8 @@ const K: usize = 6; #[proc_macro] pub fn MustBe(input: TokenStream) -> TokenStream { let lit = parse_macro_input!(input as Lit); + + #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] let expanded = match lit { Lit::Str(lit) => must_be_str(lit.value()), Lit::Byte(lit) => must_be_byte(lit.value()), @@ -27,9 +29,9 @@ pub fn MustBe(input: TokenStream) -> TokenStream { Lit::Int(lit) => must_be_int(lit), Lit::Bool(lit) => must_be_bool(lit.value), Lit::ByteStr(_) | Lit::Float(_) | Lit::Verbatim(_) => unsupported(lit), - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => unsupported(lit), }; + expanded.unwrap_or_else(Error::into_compile_error).into() }