]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_lints/src/types/linked_list.rs
Auto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomez
[rust.git] / src / tools / clippy / clippy_lints / src / types / linked_list.rs
1 use clippy_utils::diagnostics::span_lint_and_help;
2 use clippy_utils::{match_def_path, paths};
3 use rustc_hir::{self as hir, def_id::DefId};
4 use rustc_lint::LateContext;
5
6 use super::LINKEDLIST;
7
8 pub(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 }