Skip to content

Commit

Permalink
Rollup merge of rust-lang#111648 - Nilstrieb:language-items, r=Waffle…
Browse files Browse the repository at this point in the history
…Lapkin

Remove `LangItems::require`

It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff.
  • Loading branch information
Dylan-DPC authored May 17, 2023
2 parents fcb1327 + fc12637 commit 506b50e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clippy_lints/src/matches/redundant_pattern_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,11 @@ fn is_pat_variant(cx: &LateContext<'_>, pat: &Pat<'_>, path: &QPath<'_>, expecte
let Some(id) = cx.typeck_results().qpath_res(path, pat.hir_id).opt_def_id() else { return false };

match expected_item {
Item::Lang(expected_lang_item) => {
let expected_id = cx.tcx.lang_items().require(expected_lang_item).unwrap();
cx.tcx.parent(id) == expected_id
},
Item::Lang(expected_lang_item) => cx
.tcx
.lang_items()
.get(expected_lang_item)
.map_or(false, |expected_id| cx.tcx.parent(id) == expected_id),
Item::Diag(expected_ty, expected_variant) => {
let ty = cx.typeck_results().pat_ty(pat);

Expand Down

0 comments on commit 506b50e

Please sign in to comment.