mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
Various refactorings (#2281)
Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
@ -6,7 +6,7 @@ use std::convert::TryFrom;
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
||||
use quote::{format_ident, quote, ToTokens, TokenStreamExt};
|
||||
use syn::{parse_macro_input, AttributeArgs, Ident, NestedMeta};
|
||||
use syn::{parse_macro_input, AttributeArgs, Ident, LitStr, NestedMeta};
|
||||
|
||||
enum ResourceType {
|
||||
Async,
|
||||
@ -227,8 +227,7 @@ impl Route {
|
||||
format!(
|
||||
r#"invalid service definition, expected #[{}("<some path>")]"#,
|
||||
method
|
||||
.map(|it| it.as_str())
|
||||
.unwrap_or("route")
|
||||
.map_or("route", |it| it.as_str())
|
||||
.to_ascii_lowercase()
|
||||
),
|
||||
));
|
||||
@ -298,7 +297,7 @@ impl ToTokens for Route {
|
||||
} = self;
|
||||
let resource_name = resource_name
|
||||
.as_ref()
|
||||
.map_or_else(|| name.to_string(), |n| n.value());
|
||||
.map_or_else(|| name.to_string(), LitStr::value);
|
||||
let method_guards = {
|
||||
let mut others = methods.iter();
|
||||
// unwrapping since length is checked to be at least one
|
||||
|
Reference in New Issue
Block a user