]> git.lizzy.rs Git - rust.git/blob - clippy_lints/src/types/linked_list.rs
Move linked_list to its own module
[rust.git] / clippy_lints / src / types / linked_list.rs
1 use rustc_hir::{self as hir, def_id::DefId};
2 use rustc_lint::LateContext;
3
4 use crate::utils::{match_def_path, paths, span_lint_and_help};
5
6 pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, def_id: DefId) -> bool {
7     if match_def_path(cx, def_id, &paths::LINKED_LIST) {
8         span_lint_and_help(
9             cx,
10             super::LINKEDLIST,
11             hir_ty.span,
12             "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?",
13             None,
14             "a `VecDeque` might work",
15         );
16         true
17     } else {
18         false
19     }
20 }