This commit is contained in:
2022-07-10 14:07:25 +00:00
committed by GitHub
parent ff2c93ee8f
commit 60222a499b
9 changed files with 146 additions and 25 deletions

View File

@@ -637,7 +637,7 @@ pub fn check_json_keys(item: TokenStream) -> TokenStream {
for (key, sobj) in self.data.entries() {
match key {
#(#streams)*
_ => { Err(format!("{} {}", gettext("Key <key> is handled:").replace("<key>", key).as_str(), obj))?; }
_ => { Err(format!("{} {}", gettext("Key <key> is not handled:").replace("<key>", key).as_str(), obj))?; }
}
}
}
@@ -645,7 +645,7 @@ pub fn check_json_keys(item: TokenStream) -> TokenStream {
stream.into()
}
#[proc_macro_derive(CheckUnkown)]
#[proc_macro_derive(CheckUnknown)]
pub fn derive_check_unknown(item: TokenStream) -> TokenStream {
let ItemEnum {
attrs: _,
@@ -670,12 +670,12 @@ pub fn derive_check_unknown(item: TokenStream) -> TokenStream {
);
} else {
streams.push(
quote!(Self::#ident(tmp) => crate::fanbox::check::CheckUnkown::check_unknown(tmp),),
quote!(Self::#ident(tmp) => crate::fanbox::check::CheckUnknown::check_unknown(tmp),),
);
}
}
let stream = quote!(
impl crate::fanbox::check::CheckUnkown for #ident {
impl crate::fanbox::check::CheckUnknown for #ident {
fn check_unknown(&self) -> Result<(), crate::fanbox::error::FanboxAPIError> {
match self {
#(#streams)*