diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2019-05-13 11:29:54 -0700 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2019-05-13 11:39:14 -0700 |
| commit | 42480fd0313028c40b103700dcb03da25f248685 (patch) | |
| tree | 8071dd2820502caee69851779342780ccf26330c | |
| parent | c79838e5d61f3ff130c67aa04f5478bbae38f31d (diff) | |
| download | rust-42480fd0313028c40b103700dcb03da25f248685.tar.gz rust-42480fd0313028c40b103700dcb03da25f248685.zip | |
Rustup to rustc 1.36.0-nightly (1764b2972 2019-05-12)
| -rw-r--r-- | clippy_lints/src/approx_const.rs | 6 | ||||
| -rw-r--r-- | clippy_lints/src/len_zero.rs | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 6b327cf6191..189ee417281 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -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}"), diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index f464ebd03dd..0ce4576b22b 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -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; |
