about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-05-16 19:23:38 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-05-16 19:53:38 +0200
commitc3efa51947c3b14652d1e85dd3bb406522c8af22 (patch)
tree141af3a75d1a95f3f69a43e2b2024fca1d090070 /src/tools
parentcba14074bb4cc12bfe918eabd0d52a3999b2a461 (diff)
Remove `LangItems::require`
It's just a short wrapper used by `tcx.require_lang_item`. Deleting it
gives us a negative diff.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs b/src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs
index af121f317cd..0809837d1fd 100644
--- a/src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs
+++ b/src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs
@@ -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);