api-macros: Refactor unique_lifetimes_to_tokens
This commit is contained in:
parent
fff4e97035
commit
a59c43321f
@ -12,12 +12,11 @@ pub(crate) fn unique_lifetimes_to_tokens<'a, I: IntoIterator<Item = &'a Lifetime
|
|||||||
lifetimes: I,
|
lifetimes: I,
|
||||||
) -> TokenStream {
|
) -> TokenStream {
|
||||||
let lifetimes = lifetimes.into_iter().collect::<BTreeSet<_>>();
|
let lifetimes = lifetimes.into_iter().collect::<BTreeSet<_>>();
|
||||||
(!lifetimes.is_empty())
|
if lifetimes.is_empty() {
|
||||||
.then(|| {
|
TokenStream::new()
|
||||||
let lifetimes = quote! { #( #lifetimes ),* };
|
} else {
|
||||||
quote! { < #lifetimes > }
|
quote! { < #( #lifetimes ),* > }
|
||||||
})
|
}
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_valid_endpoint_path(string: &str) -> bool {
|
pub(crate) fn is_valid_endpoint_path(string: &str) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user