| 222 | } |
| 223 | |
| 224 | fn contains_non_static_lifetime(ty: &Type) -> bool { |
| 225 | match ty { |
| 226 | Type::Path(ty) => { |
| 227 | let bracketed = match &ty.path.segments.last().unwrap().arguments { |
| 228 | PathArguments::AngleBracketed(bracketed) => bracketed, |
| 229 | _ => return false, |
| 230 | }; |
| 231 | for arg in &bracketed.args { |
| 232 | match arg { |
| 233 | GenericArgument::Type(ty) if contains_non_static_lifetime(ty) => return true, |
| 234 | GenericArgument::Lifetime(lifetime) if lifetime.ident != "static" => { |
| 235 | return true |
| 236 | } |
| 237 | _ => {} |
| 238 | } |
| 239 | } |
| 240 | false |
| 241 | } |
| 242 | Type::Reference(ty) => ty |
| 243 | .lifetime |
| 244 | .as_ref() |
| 245 | .map_or(false, |lifetime| lifetime.ident != "static"), |
| 246 | _ => false, // maybe implement later if there are common other cases |
| 247 | } |
| 248 | } |