mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Merge pull request #3036 from matthiaskrgr/clippy_self
fix 2 clippy warnings
This commit is contained in:
commit
826d998cd2
2 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Reference in a new issue