Function clippy_utils::ty::implements_trait
source · pub fn implements_trait<'tcx>(
cx: &LateContext<'tcx>,
ty: Ty<'tcx>,
trait_id: DefId,
ty_params: &[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.