Skip to content

Commit 488b8c5

Browse files
committed
Auto merge of #3633 - matthiaskrgr:rustup, r=phansch
rustup (don't know the exact PR unfortunately)
2 parents cf3fb90 + a4b99c6 commit 488b8c5

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

clippy_lints/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
304304
};
305305

306306
let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?;
307-
let ret = miri_to_const(self.tcx, result);
307+
let ret = miri_to_const(self.tcx, &result);
308308
if ret.is_some() {
309309
self.needed_resolution = true;
310310
}

clippy_lints/src/enum_clike.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
7070
promoted: None,
7171
};
7272
let constant = cx.tcx.const_eval(param_env.and(c_id)).ok();
73-
if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, c)) {
73+
if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, &c)) {
7474
let mut ty = cx.tcx.type_of(def_id);
7575
if let ty::Adt(adt, _) = ty.sty {
7676
if adt.is_enum() {

clippy_lints/src/len_zero.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,15 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
302302

303303
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
304304
match ty.sty {
305-
ty::Dynamic(ref tt, ..) => cx
306-
.tcx
307-
.associated_items(tt.principal().def_id())
308-
.any(|item| is_is_empty(cx, &item)),
305+
ty::Dynamic(ref tt, ..) => {
306+
if let Some(principal) = tt.principal() {
307+
cx.tcx
308+
.associated_items(principal.def_id())
309+
.any(|item| is_is_empty(cx, &item))
310+
} else {
311+
false
312+
}
313+
},
309314
ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
310315
ty::Adt(id, _) => has_is_empty_impl(cx, id.did),
311316
ty::Array(..) | ty::Slice(..) | ty::Str => true,

0 commit comments

Comments
 (0)