fn check_use_slice_cloned_kind()

in gazebo_lint/src/lib.rs [280:298]


fn check_use_slice_cloned_kind(
    cx: &LateContext,
    expr: &Expr,
    clone_kind: Symbol,
    lint_kind: &'static Lint,
) {
    let (root, method_names, _arg_lists, _method_spans) = clippy::method_calls(expr, 3);
    if method_names == [sym!(collect), clone_kind, sym!(iter)]
        && clippy::match_ty_path(
            cx,
            cx.typeck_results().expr_ty(expr),
            &["alloc", "vec", "Vec"],
            &[],
        )
        && cx.typeck_results().expr_ty_adjusted(root).is_slice()
    {
        emit_lint(cx, lint_kind, expr.span);
    }
}