clippy_utils::ty

Function contains_ty_adt_constructor_opaque

Source
pub fn contains_ty_adt_constructor_opaque<'tcx>(
    cx: &LateContext<'tcx>,
    ty: Ty<'tcx>,
    needle: Ty<'tcx>,
) -> bool
Expand description

Walks into ty and returns true if any inner type is an instance of the given type, or adt constructor of the same type.

This method also recurses into opaque type predicates, so call it with impl Trait<U> and U will also return true.