Skip to content

Commit 14f3445

Browse files
committed
Don't lint DequeVec in manual_memcpy
1 parent 0e28e38 commit 14f3445

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::{IncrementVisitor, InitializeVisitor, MANUAL_MEMCPY};
22
use clippy_utils::diagnostics::span_lint_and_sugg;
33
use clippy_utils::source::snippet;
44
use clippy_utils::sugg::Sugg;
5-
use clippy_utils::ty::is_type_diagnostic_item;
65
use clippy_utils::{get_enclosing_block, higher, path_to_local, sugg};
76
use if_chain::if_chain;
87
use rustc_ast::ast;
@@ -325,13 +324,12 @@ struct Start<'hir> {
325324
}
326325

327326
fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool {
328-
let is_slice = match ty.kind() {
327+
match ty.kind() {
328+
ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::Vec, adt.did),
329329
ty::Ref(_, subty, _) => is_slice_like(cx, subty),
330330
ty::Slice(..) | ty::Array(..) => true,
331331
_ => false,
332-
};
333-
334-
is_slice || is_type_diagnostic_item(cx, ty, sym::Vec) || is_type_diagnostic_item(cx, ty, sym::VecDeque)
332+
}
335333
}
336334

337335
fn fetch_cloned_expr<'tcx>(expr: &'tcx Expr<'tcx>) -> &'tcx Expr<'tcx> {

0 commit comments

Comments
 (0)