Merge pull request #3036 from matthiaskrgr/clippy_self

fix 2 clippy warnings
This commit is contained in:
Philipp Krones 2018-08-14 12:53:01 +02:00 committed by GitHub
commit 826d998cd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -63,7 +63,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp {
fn check(cx: &LateContext<'_, '_>, e: &Expr, m: i8, span: Span, arg: Span) {
if let Some(Constant::Int(v)) = constant_simple(cx, cx.tables, e) {
let check = match cx.tables.expr_ty(e).sty {
ty::TyInt(ity) => unsext(cx.tcx, -1i128, ity),
ty::TyInt(ity) => unsext(cx.tcx, -1_i128, ity),
ty::TyUint(uty) => clip(cx.tcx, !0, uty),
_ => return,
};

View file

@ -244,9 +244,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
}
}
let ty = if !needs_check_adjustment {
cx.tables.expr_ty(dereferenced_expr)
} else {
let ty = if needs_check_adjustment {
let adjustments = cx.tables.expr_adjustments(dereferenced_expr);
if let Some(i) = adjustments.iter().position(|adj| match adj.kind {
Adjust::Borrow(_) | Adjust::Deref(_) => true,
@ -261,6 +259,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
// No borrow adjustments = the entire const is moved.
return;
}
} else {
cx.tables.expr_ty(dereferenced_expr)
};
verify_ty_bound(cx, ty, Source::Expr { expr: expr.span });