diff options
| author | Fuwn <[email protected]> | 2026-01-21 09:03:05 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-21 09:03:05 +0000 |
| commit | 43fb2c613448589e0bac61996f38653cbefebd45 (patch) | |
| tree | 8439711dcdca6227672a24538ee34fc0064e1c1a /rossweisse/src/implementations/router/methods.rs | |
| parent | perf(router): Reduce per-connection overhead with shared RequestHandler (diff) | |
| download | windmark-43fb2c613448589e0bac61996f38653cbefebd45.tar.xz windmark-43fb2c613448589e0bac61996f38653cbefebd45.zip | |
fix(rossweisse): Fix all clippy pedantic and nursery lint errors
Diffstat (limited to 'rossweisse/src/implementations/router/methods.rs')
| -rw-r--r-- | rossweisse/src/implementations/router/methods.rs | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/rossweisse/src/implementations/router/methods.rs b/rossweisse/src/implementations/router/methods.rs index 2ae4086..18f639b 100644 --- a/rossweisse/src/implementations/router/methods.rs +++ b/rossweisse/src/implementations/router/methods.rs @@ -25,30 +25,25 @@ pub fn methods( .items .iter_mut() .filter_map(|item| { - if let syn::ImplItem::Fn(method) = item { - for attribute in method.attrs.iter() { - if attribute.path().is_ident("route") { - let arguments = quote::ToTokens::into_token_stream(attribute) - .to_string() - .trim_end_matches(")]") - .trim_start_matches("#[route(") - .to_string(); + let syn::ImplItem::Fn(method) = item else { + return None; + }; + let route_attrribute = method + .attrs + .iter() + .find(|attribute| attribute.path().is_ident("route"))?; + let arguments = quote::ToTokens::into_token_stream(route_attrribute) + .to_string() + .trim_end_matches(")]") + .trim_start_matches("#[route(") + .to_string(); - if arguments == "index" { - method.sig.ident = - syn::Ident::new("__router_index", method.sig.ident.span()); - } - - return Some(method.sig.ident.clone()); - } else { - return None; - } - } - - None - } else { - None + if arguments == "index" { + method.sig.ident = + syn::Ident::new("__router_index", method.sig.ident.span()); } + + Some(method.sig.ident.clone()) }) .collect::<Vec<_>>(); let (implementation_generics, type_generics, where_clause) = @@ -60,7 +55,7 @@ pub fn methods( format!( "/{}", if route == "__router_index" { - "".to_string() + String::new() } else { route.to_string() } |