Ignore calls to 'len'
This commit is contained in:
parent
6bd9cd99a3
commit
566377f627
1 changed files with 15 additions and 0 deletions
|
|
@ -1614,6 +1614,21 @@ fn lint_or_fun_call<'a, 'tcx>(
|
|||
or_has_args: bool,
|
||||
span: Span,
|
||||
) {
|
||||
if let hir::ExprKind::MethodCall(ref path, _, ref args) = &arg.node {
|
||||
if path.ident.as_str() == "len" {
|
||||
let ty = walk_ptrs_ty(cx.tables.expr_ty(&args[0]));
|
||||
|
||||
match ty.sty {
|
||||
ty::Slice(_) | ty::Array(_, _) => return,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
if match_type(cx, ty, &paths::VEC) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// (path, fn_has_argument, methods, suffix)
|
||||
let know_types: &[(&[_], _, &[_], _)] = &[
|
||||
(&paths::BTREEMAP_ENTRY, false, &["or_insert"], "with"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue