]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
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 | 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 | } |