diff options
| author | bors <bors@rust-lang.org> | 2019-01-05 08:02:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-05 08:02:50 +0000 |
| commit | 488b8c5f6ff18d493bbd9ab95967ac38c3db3c6d (patch) | |
| tree | 1b72e29707ad906dff7d6268af96683534792d27 | |
| parent | cf3fb908c8479f923fb2518e5cc70f4e6440239f (diff) | |
| parent | a4b99c6d6881b7e2149320d86794db0a9cdaed85 (diff) | |
| download | rust-488b8c5f6ff18d493bbd9ab95967ac38c3db3c6d.tar.gz rust-488b8c5f6ff18d493bbd9ab95967ac38c3db3c6d.zip | |
Auto merge of #3633 - matthiaskrgr:rustup, r=phansch
rustup (don't know the exact PR unfortunately)
| -rw-r--r-- | clippy_lints/src/consts.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/enum_clike.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/len_zero.rs | 13 |
3 files changed, 11 insertions, 6 deletions
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 8369f4b4470..8102a416d82 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -304,7 +304,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { }; let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?; - let ret = miri_to_const(self.tcx, result); + let ret = miri_to_const(self.tcx, &result); if ret.is_some() { self.needed_resolution = true; } diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 29038cda869..78cade1f2fb 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -70,7 +70,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant { promoted: None, }; let constant = cx.tcx.const_eval(param_env.and(c_id)).ok(); - if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, c)) { + if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, &c)) { let mut ty = cx.tcx.type_of(def_id); if let ty::Adt(adt, _) = ty.sty { if adt.is_enum() { diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 61aa228729c..233bea77e03 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -302,10 +302,15 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr) -> bool { let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr)); match ty.sty { - ty::Dynamic(ref tt, ..) => cx - .tcx - .associated_items(tt.principal().def_id()) - .any(|item| is_is_empty(cx, &item)), + ty::Dynamic(ref tt, ..) => { + if let Some(principal) = tt.principal() { + cx.tcx + .associated_items(principal.def_id()) + .any(|item| is_is_empty(cx, &item)) + } else { + false + } + }, ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id), ty::Adt(id, _) => has_is_empty_impl(cx, id.did), ty::Array(..) | ty::Slice(..) | ty::Str => true, |
