]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_lints/src/types/linked_list.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / src / tools / clippy / clippy_lints / src / types / linked_list.rs
1 use clippy_utils::diagnostics::span_lint_and_help;
2 use rustc_hir::{self as hir, def_id::DefId};
3 use rustc_lint::LateContext;
4 use rustc_span::symbol::sym;
5
6 use super::LINKEDLIST;
7
8 pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, def_id: DefId) -> bool {
9     if cx.tcx.is_diagnostic_item(sym::LinkedList, def_id) {
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 }