Function clippy_utils::is_trait_item

source ยท
pub fn is_trait_item(
    cx: &LateContext<'_>,
    expr: &Expr<'_>,
    diag_item: Symbol,
) -> bool
Expand description

Checks if the given expression is a path referring an item on the trait that is marked with the given diagnostic item.

For checking method call expressions instead of path expressions, use is_trait_method.

For example, this can be used to find if an expression like u64::default refers to an item of the trait Default, which is associated with the diag_item of sym::Default.