fix 2 clippy warnings

This commit is contained in:
Matthias Krüger 2018-08-11 23:07:04 +02:00
parent 7a5ede677b
commit 66ca3954ec
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 });