@@ -17,7 +17,11 @@ pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream> {
|
||||
|
||||
pub(super) fn command_dispatch(item: ItemEnum, _args: &[Meta]) -> Result<TokenStream> {
|
||||
let name = &item.ident;
|
||||
let arm: Vec<TokenStream2> = item.variants.iter().map(dispatch_arm).try_collect()?;
|
||||
let arm: Vec<TokenStream2> = item
|
||||
.variants
|
||||
.iter()
|
||||
.map(dispatch_arm)
|
||||
.try_collect()?;
|
||||
let switch = quote! {
|
||||
#[allow(clippy::large_stack_frames)] //TODO: fixme
|
||||
pub(super) async fn process(
|
||||
@@ -44,7 +48,10 @@ fn dispatch_arm(v: &Variant) -> Result<TokenStream2> {
|
||||
let handler = Ident::new(&target, Span::call_site().into());
|
||||
let res = match &v.fields {
|
||||
| Fields::Named(fields) => {
|
||||
let field = fields.named.iter().filter_map(|f| f.ident.as_ref());
|
||||
let field = fields
|
||||
.named
|
||||
.iter()
|
||||
.filter_map(|f| f.ident.as_ref());
|
||||
let arg = field.clone();
|
||||
quote! {
|
||||
#name { #( #field ),* } => {
|
||||
|
||||
@@ -251,7 +251,12 @@ fn get_doc_comment_full(field: &Field) -> Option<String> {
|
||||
continue;
|
||||
};
|
||||
|
||||
if path.segments.iter().next().is_none_or(|s| s.ident != "doc") {
|
||||
if path
|
||||
.segments
|
||||
.iter()
|
||||
.next()
|
||||
.is_none_or(|s| s.ident != "doc")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,12 @@ pub(crate) fn get_simple_settings(args: &[Meta]) -> HashMap<String, String> {
|
||||
return map;
|
||||
};
|
||||
|
||||
if let Some(key) = path.segments.iter().next().map(|s| s.ident.clone()) {
|
||||
if let Some(key) = path
|
||||
.segments
|
||||
.iter()
|
||||
.next()
|
||||
.map(|s| s.ident.clone())
|
||||
{
|
||||
map.insert(key.to_string(), str.value());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user