Skip to content

Commit 8a969f7

Browse files
committed
entry: use get_diagnostic_item
1 parent 58b6462 commit 8a969f7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clippy_lints/src/entry.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,10 @@ fn try_parse_contains<'tcx>(cx: &LateContext<'_>, expr: &'tcx Expr<'_>) -> Optio
274274
key,
275275
call_ctxt: expr.span.ctxt(),
276276
};
277-
if cx.tcx.is_diagnostic_item(sym::btreemap_contains_key, id) {
278-
Some((MapType::BTree, expr))
279-
} else if cx.tcx.is_diagnostic_item(sym::hashmap_contains_key, id) {
280-
Some((MapType::Hash, expr))
281-
} else {
282-
None
277+
match cx.tcx.get_diagnostic_name(id) {
278+
Some(sym::btreemap_contains_key) => Some((MapType::BTree, expr)),
279+
Some(sym::hashmap_contains_key) => Some((MapType::Hash, expr)),
280+
_ => None,
283281
}
284282
},
285283
_ => None,

0 commit comments

Comments
 (0)