Skip to content

Commit c5215b6

Browse files
committed
clean-up a bit
1 parent 973e596 commit c5215b6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clippy_lints/src/manual_option_as_slice.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_errors::Applicability;
77
use rustc_hir::def::{DefKind, Res};
88
use rustc_hir::{Arm, Expr, ExprKind, LangItem, Pat, PatKind, QPath, is_range_literal};
99
use rustc_lint::{LateContext, LateLintPass};
10-
use rustc_middle::ty;
1110
use rustc_session::impl_lint_pass;
1211
use rustc_span::{Span, Symbol};
1312

@@ -124,8 +123,7 @@ fn check_map(cx: &LateContext<'_>, map: &Expr<'_>, span: Span, msrv: Msrv) {
124123
fn check_as_ref(cx: &LateContext<'_>, expr: &Expr<'_>, span: Span, msrv: Msrv) {
125124
if let ExprKind::MethodCall(seg, callee, [], _) = expr.kind
126125
&& seg.ident.name == sym::as_ref
127-
&& let ty::Adt(adtdef, ..) = cx.typeck_results().expr_ty(callee).kind()
128-
&& cx.tcx.is_diagnostic_item(sym::Option, adtdef.did())
126+
&& cx.typeck_results().expr_ty(callee).is_diag_item(cx, sym::Option)
129127
&& msrv.meets(
130128
cx,
131129
if clippy_utils::is_in_const_context(cx) {

0 commit comments

Comments
 (0)