]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/clippy_lints/src/types/linked_list.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / clippy_lints / src / types / linked_list.rs
CommitLineData
f20569fa
XL
1use rustc_hir::{self as hir, def_id::DefId};
2use rustc_lint::LateContext;
3
4use crate::utils::{match_def_path, paths, span_lint_and_help};
5
6use super::LINKEDLIST;
7
8pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, def_id: DefId) -> bool {
9 if match_def_path(cx, def_id, &paths::LINKED_LIST) {
10 span_lint_and_help(
11 cx,
12 LINKEDLIST,
13 hir_ty.span,
14 "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?",
15 None,
16 "a `VecDeque` might work",
17 );
18 true
19 } else {
20 false
21 }
22}