mirror of https://github.com/fafhrd91/actix-web
fix a little string & use map_or_else instead of if-else
This commit is contained in:
parent
2430ea9d9e
commit
3496be9d0c
|
@ -117,7 +117,7 @@ impl Args {
|
||||||
} else {
|
} else {
|
||||||
return Err(syn::Error::new_spanned(
|
return Err(syn::Error::new_spanned(
|
||||||
nv.lit,
|
nv.lit,
|
||||||
"Attribute endpoint expects literal string!",
|
"Attribute name expects literal string!",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else if nv.path.is_ident("guard") {
|
} else if nv.path.is_ident("guard") {
|
||||||
|
@ -296,11 +296,9 @@ impl ToTokens for Route {
|
||||||
resource_type,
|
resource_type,
|
||||||
doc_attributes,
|
doc_attributes,
|
||||||
} = self;
|
} = self;
|
||||||
let resource_name = if let Some(resource_name) = resource_name {
|
let resource_name = resource_name
|
||||||
resource_name.value()
|
.as_ref()
|
||||||
} else {
|
.map_or_else(|| name.to_string(), |n| n.value());
|
||||||
name.to_string()
|
|
||||||
};
|
|
||||||
let method_guards = {
|
let method_guards = {
|
||||||
let mut others = methods.iter();
|
let mut others = methods.iter();
|
||||||
// unwrapping since length is checked to be at least one
|
// unwrapping since length is checked to be at least one
|
||||||
|
|
Loading…
Reference in New Issue