Skip to content

Commit 11375b5

Browse files
committed
Use LanguageItems::require
1 parent f21320f commit 11375b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
360360
let trait_ref = &poly_tref.trait_ref;
361361
if CLOSURE_TRAIT_BOUNDS
362362
.iter()
363-
.any(|&item| trait_ref.trait_def_id() == self.cx.tcx.lang_items().items()[item as usize])
363+
.any(|&item| trait_ref.trait_def_id() == self.cx.tcx.lang_items().require(item).ok())
364364
{
365365
let mut sub_visitor = RefVisitor::new(self.cx);
366366
sub_visitor.visit_trait_ref(trait_ref);

clippy_lints/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ fn is_ty_param_lang_item(cx: &LateContext<'_>, qpath: &QPath<'tcx>, item: LangIt
294294
if let TyKind::Path(qpath) = &ty.kind {
295295
cx.qpath_res(qpath, ty.hir_id)
296296
.opt_def_id()
297-
.and_then(|id| (cx.tcx.lang_items().items()[item as usize] == Some(id)).then(|| ty))
297+
.and_then(|id| (cx.tcx.lang_items().require(item) == Ok(id)).then(|| ty))
298298
} else {
299299
None
300300
}

0 commit comments

Comments
 (0)