Merge remote-tracking branch 'upstream/master' into rustup
This commit is contained in:
commit
145d5adf04
282 changed files with 5798 additions and 885 deletions
|
|
@ -104,7 +104,7 @@ impl ArithmeticSideEffects {
|
|||
|
||||
if !tcx.is_diagnostic_item(sym::NonZero, adt.did()) {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
let int_type = substs.type_at(0);
|
||||
let unsigned_int_types = [
|
||||
|
|
@ -214,13 +214,13 @@ impl ArithmeticSideEffects {
|
|||
| hir::BinOpKind::Sub
|
||||
) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
let (mut actual_lhs, lhs_ref_counter) = peel_hir_expr_refs(lhs);
|
||||
let (mut actual_rhs, rhs_ref_counter) = peel_hir_expr_refs(rhs);
|
||||
actual_lhs = expr_or_init(cx, actual_lhs);
|
||||
actual_rhs = expr_or_init(cx, actual_rhs);
|
||||
let lhs_ty = cx.typeck_results().expr_ty(actual_lhs).peel_refs();
|
||||
let rhs_ty = cx.typeck_results().expr_ty(actual_rhs).peel_refs();
|
||||
let rhs_ty = cx.typeck_results().expr_ty_adjusted(actual_rhs).peel_refs();
|
||||
if self.has_allowed_binary(lhs_ty, rhs_ty) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ impl ArithmeticSideEffects {
|
|||
if ConstEvalCtxt::new(cx).eval_simple(receiver).is_some() {
|
||||
return;
|
||||
}
|
||||
let instance_ty = cx.typeck_results().expr_ty(receiver);
|
||||
let instance_ty = cx.typeck_results().expr_ty_adjusted(receiver);
|
||||
if !Self::is_integral(instance_ty) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ impl ArithmeticSideEffects {
|
|||
if ConstEvalCtxt::new(cx).eval(un_expr).is_some() {
|
||||
return;
|
||||
}
|
||||
let ty = cx.typeck_results().expr_ty(expr).peel_refs();
|
||||
let ty = cx.typeck_results().expr_ty_adjusted(expr).peel_refs();
|
||||
if self.has_allowed_unary(ty) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ fn check_op(cx: &LateContext<'_>, expr: &Expr<'_>, other: &Expr<'_>, left: bool)
|
|||
} else {
|
||||
expr_snip = arg_snip.to_string();
|
||||
eq_impl = without_deref;
|
||||
};
|
||||
}
|
||||
|
||||
let span;
|
||||
let hint;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ pub(super) fn check<'tcx>(
|
|||
None,
|
||||
note,
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,5 +49,5 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, op: BinOpKind, lhs: &'tcx Expr
|
|||
lint_double_comparison!(==);
|
||||
},
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ fn is_float(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
|||
|
||||
if let ty::Array(arr_ty, _) = value {
|
||||
return matches!(arr_ty.kind(), ty::Float(_));
|
||||
};
|
||||
}
|
||||
|
||||
matches!(value, ty::Float(_))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ declare_clippy_lint! {
|
|||
/// to `trailing_zeros`
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// `x.trailing_zeros() > 4` is much clearer than `x & 15
|
||||
/// `x.trailing_zeros() >= 4` is much clearer than `x & 15
|
||||
/// == 0`
|
||||
///
|
||||
/// ### Known problems
|
||||
|
|
@ -278,7 +278,7 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ```no_run
|
||||
/// # let x: i32 = 1;
|
||||
/// if x.trailing_zeros() > 4 { }
|
||||
/// if x.trailing_zeros() >= 4 { }
|
||||
/// ```
|
||||
#[clippy::version = "pre 1.29.0"]
|
||||
pub VERBOSE_BIT_MASK,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub(super) fn check<'tcx>(
|
|||
} else {
|
||||
check_non_const_operands(cx, e, lhs);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn used_in_comparison_with_zero(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, op: BinOpKind, right:
|
|||
"any number modulo -1 will panic/overflow or result in 0",
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue