add tengri_core; fix errors and warnings; unify deps

This commit is contained in:
🪞👃🪞 2025-05-10 15:25:09 +03:00
parent cb8fd26922
commit 8dda576c9d
18 changed files with 180 additions and 152 deletions

View file

@ -10,10 +10,7 @@ pub(crate) struct CommandMeta(Ident);
pub(crate) struct CommandImpl(ItemImpl, BTreeMap<Arc<str>, CommandArm>);
#[derive(Debug, Clone)]
struct CommandArm(Ident, Vec<FnArg>, ReturnType);
#[derive(Debug, Clone)]
struct CommandVariant(Ident, Vec<FnArg>);
struct CommandArm(Ident, Vec<FnArg>, #[allow(unused)] ReturnType);
impl Parse for CommandMeta {
fn parse (input: ParseStream) -> Result<Self> {
@ -203,25 +200,3 @@ impl CommandArm {
write_quote(quote! { Self::#variant => Self::#ident(state, #(#give_args)* #give_rest), })
}
}
impl ToTokens for CommandVariant {
fn to_tokens (&self, out: &mut TokenStream2) {
let Self(ident, args) = self;
out.append(LitStr::new(&format!("{}", ident), Span::call_site())
.token());
out.append(Group::new(Delimiter::Parenthesis, {
let mut out = TokenStream2::new();
for arg in args.iter() {
if let FnArg::Typed(PatType { ty, .. }) = arg {
out.append(LitStr::new(
&format!("{}", quote! { #ty }),
Span::call_site()
).token());
out.append(Punct::new(',', Alone));
}
}
out
}));
out.append(Punct::new(',', Alone));
}
}