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,
|
||||
) -> TokenStream {
|
||||
let lifetimes = lifetimes.into_iter().collect::<BTreeSet<_>>();
|
||||
(!lifetimes.is_empty())
|
||||
.then(|| {
|
||||
let lifetimes = quote! { #( #lifetimes ),* };
|
||||
quote! { < #lifetimes > }
|
||||
})
|
||||
.unwrap_or_default()
|
||||
if lifetimes.is_empty() {
|
||||
TokenStream::new()
|
||||
} else {
|
||||
quote! { < #( #lifetimes ),* > }
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_valid_endpoint_path(string: &str) -> bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user