Skip to content

Commit

Permalink
Shorter BareFn
Browse files Browse the repository at this point in the history
  • Loading branch information
someguynamedjosh committed Oct 18, 2021
1 parent a5cd598 commit 927d01e
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ouroboros_macro/src/covariance_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,8 @@ pub fn type_is_covariant_over_this_lifetime(ty: &syn::Type) -> Option<bool> {
match ty {
Array(arr) => type_is_covariant_over_this_lifetime(&*arr.elem),
BareFn(f) => {
for arg in f.inputs.iter() {
if uses_this_lifetime(arg.ty.to_token_stream()) {
return None;
}
}
if let syn::ReturnType::Type(_, ty) = &f.output {
if uses_this_lifetime(ty.to_token_stream()) {
return None;
}
}
Some(true)
debug_assert!(uses_this_lifetime(f.to_token_stream()));
None
}
Group(ty) => type_is_covariant_over_this_lifetime(&ty.elem),
ImplTrait(..) => None, // Unusable in struct definition.
Expand Down

0 comments on commit 927d01e

Please sign in to comment.