difftreelog
fix PR suggestions
in: master
1 file changed
crates/evm-coder/procedural/src/abi_derive/derive_enum.rsdiffbeforeafterboth13 #[cfg(feature = "stubgen")]13 #[cfg(feature = "stubgen")]14 impl ::evm_coder::solidity::SolidityEnum for #name {14 impl ::evm_coder::solidity::SolidityEnum for #name {15 fn solidity_option(&self) -> &str {15 fn solidity_option(&self) -> &str {16 match Self::default() {16 match self {17 #(#enum_options)*17 #(#enum_options)*18 }18 }19 }19 }176 Ok(count)176 Ok(count)177}177}178178179pub fn check_repr_u8(name: &syn::Ident, attrs: &Vec<syn::Attribute>) -> syn::Result<()> {179pub fn check_repr_u8(name: &syn::Ident, attrs: &Vec<syn::Attribute>) -> syn::Result<()> {180 let mut has_repr = false;180 let mut has_repr = false;181 for attr in attrs.iter() {181 for attr in attrs.iter() {182 if attr.path.is_ident("repr") {183 has_repr = true;184 let meta = attr.parse_meta()?;185 check_meta_u8(&meta)?;186 }187 }188189 if !has_repr {190 return Err(syn::Error::new(name.span(), "Enum is not \"repr(u8)\""));191 }192193 Ok(())194}195182 if attr.path.is_ident("repr") {196fn check_meta_u8(meta: &syn::Meta) -> Result<(), syn::Error> {183 has_repr = true;184 match attr.parse_meta()? {197 match meta {185 syn::Meta::List(p) => {198 syn::Meta::List(p) => {186 for nm in p.nested.iter() {199 for nm in p.nested.iter() {187 match nm {200 match nm {206 }219 }207 _ => {}220 _ => {}208 };221 };222 Ok(())209 }223}210 }211212 if !has_repr {213 return Err(syn::Error::new(name.span(), "Enum is not \"repr(u8)\""));214 }215216 Ok(())217}218224