1 use clippy_utils::last_path_segment;
2 use if_chain::if_chain;
3 use rustc_hir::{GenericArg, QPath, TyKind};
4 use rustc_lint::LateContext;
5 use rustc_span::source_map::Span;
7 pub(super) fn match_borrows_parameter(_cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option<Span> {
8 let last = last_path_segment(qpath);
10 if let Some(params) = last.args;
11 if !params.parenthesized;
12 if let Some(ty) = params.args.iter().find_map(|arg| match arg {
13 GenericArg::Type(ty) => Some(ty),
16 if let TyKind::Rptr(..) = ty.kind;