Rustup to rustc 1.36.0-nightly (1764b2972 2019-05-12)
This commit is contained in:
@@ -55,13 +55,13 @@ declare_lint_pass!(ApproxConstant => [APPROX_CONSTANT]);
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ApproxConstant {
|
||||
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
|
||||
if let ExprKind::Lit(lit) = &e.node {
|
||||
check_lit(cx, lit, e);
|
||||
check_lit(cx, &lit.node, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_lit(cx: &LateContext<'_, '_>, lit: &Lit, e: &Expr) {
|
||||
match lit.node {
|
||||
fn check_lit(cx: &LateContext<'_, '_>, lit: &LitKind, e: &Expr) {
|
||||
match *lit {
|
||||
LitKind::Float(s, FloatTy::F32) => check_known_consts(cx, e, s, "f32"),
|
||||
LitKind::Float(s, FloatTy::F64) => check_known_consts(cx, e, s, "f64"),
|
||||
LitKind::FloatUnsuffixed(s) => check_known_consts(cx, e, s, "f{32, 64}"),
|
||||
|
||||
@@ -218,7 +218,7 @@ fn check_cmp(cx: &LateContext<'_, '_>, span: Span, method: &Expr, lit: &Expr, op
|
||||
}
|
||||
}
|
||||
|
||||
check_len(cx, span, method_path.ident.name, args, lit, op, compare_to)
|
||||
check_len(cx, span, method_path.ident.name, args, &lit.node, op, compare_to)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,15 +227,11 @@ fn check_len(
|
||||
span: Span,
|
||||
method_name: Name,
|
||||
args: &[Expr],
|
||||
lit: &Lit,
|
||||
lit: &LitKind,
|
||||
op: &str,
|
||||
compare_to: u32,
|
||||
) {
|
||||
if let Spanned {
|
||||
node: LitKind::Int(lit, _),
|
||||
..
|
||||
} = *lit
|
||||
{
|
||||
if let LitKind::Int(lit, _) = *lit {
|
||||
// check if length is compared to the specified number
|
||||
if lit != u128::from(compare_to) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user