Skip to content

Commit

Permalink
fix: suppress the warning for constant case
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 22, 2024
1 parent 145ea7b commit c1e8815
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion strum_macros/src/macros/from_repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ pub fn from_repr_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
},
};

constant_defs.push(quote! {const #const_var_ident: #discriminant_type = #const_val_expr;});
constant_defs.push(quote! {
#[allow(non_upper_case_globals)]
const #const_var_ident: #discriminant_type = #const_val_expr;
});
arms.push(quote! {v if v == #const_var_ident => ::core::option::Option::Some(#name::#ident #params)});

prev_const_var_ident = Some(const_var_ident);
Expand Down

0 comments on commit c1e8815

Please sign in to comment.