diff options
| author | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-20 20:56:39 +0200 |
|---|---|---|
| committer | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-22 15:03:18 +0200 |
| commit | 8a969f709034375eed5d13dee6b44b31fcef2cf5 (patch) | |
| tree | 5054ca28d4c5f895724a0c799d2df8cd7872a60a | |
| parent | 58b646239d2ad0f757eb6930e0bb42ad69bcac15 (diff) | |
| download | rust-8a969f709034375eed5d13dee6b44b31fcef2cf5.tar.gz rust-8a969f709034375eed5d13dee6b44b31fcef2cf5.zip | |
entry: use `get_diagnostic_item`
| -rw-r--r-- | clippy_lints/src/entry.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 182cb4e46d2..4e24f69357d 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -274,12 +274,10 @@ fn try_parse_contains<'tcx>(cx: &LateContext<'_>, expr: &'tcx Expr<'_>) -> Optio key, call_ctxt: expr.span.ctxt(), }; - if cx.tcx.is_diagnostic_item(sym::btreemap_contains_key, id) { - Some((MapType::BTree, expr)) - } else if cx.tcx.is_diagnostic_item(sym::hashmap_contains_key, id) { - Some((MapType::Hash, expr)) - } else { - None + match cx.tcx.get_diagnostic_name(id) { + Some(sym::btreemap_contains_key) => Some((MapType::BTree, expr)), + Some(sym::hashmap_contains_key) => Some((MapType::Hash, expr)), + _ => None, } }, _ => None, |
