Skip to content

Instantly share code, notes, and snippets.

@CarlKCarlK
Created October 19, 2022 20:30
Show Gist options
  • Select an option

  • Save CarlKCarlK/a6eeec89ecd23a10c8d55b2f4372b5c9 to your computer and use it in GitHub Desktop.

Select an option

Save CarlKCarlK/a6eeec89ecd23a10c8d55b2f4372b5c9 to your computer and use it in GitHub Desktop.
// Even if the where clause is None, we still need to return an empty Punctuated
fn extract_where_predicates(item_fn: &ItemFn) -> Punctuated<WherePredicate, Comma> {
if let Some(WhereClause { predicates, .. }) = &item_fn.sig.generics.where_clause {
predicates.clone()
} else {
parse_quote!()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment