Function clippy_utils::ty::implements_trait
source ยท pub fn implements_trait<'tcx>(
cx: &LateContext<'tcx>,
ty: Ty<'tcx>,
trait_id: DefId,
args: &[GenericArg<'tcx>],
) -> bool
Expand description
Checks whether a type implements a trait. The function returns false in case the type contains an inference variable.
See:
get_trait_def_id
to get a traitDefId
.- Common tools for writing lints for an example how to use this function and other options.