Skip to content

Commit

Permalink
Merge pull request #7 from dtolnay/exhaustive
Browse files Browse the repository at this point in the history
Pick up changes to non_exhaustive_omitted_patterns lint
  • Loading branch information
dtolnay authored Jan 4, 2024
2 parents edf596e + f2f4826 commit ee9c56f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ 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()),
Lit::Char(lit) => must_be_char(lit.value()),
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()
}

Expand Down

0 comments on commit ee9c56f

Please sign in to comment.