]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/duration_subsec.rs
Auto merge of #4551 - mikerite:fix-ice-reporting, r=llogiq
[rust.git] / clippy_lints / src / duration_subsec.rs
index 79c9e885891115cd63f07fb65c277b9c93e65cdc..1346aea3ed0a76c2d70bc60b785167adad7122f3 100644 (file)
@@ -20,6 +20,7 @@
     ///
     /// **Example:**
     /// ```rust
+    /// # use std::time::Duration;
     /// let dur = Duration::new(5, 0);
     /// let _micros = dur.subsec_nanos() / 1_000;
     /// let _millis = dur.subsec_nanos() / 1_000_000;
@@ -36,7 +37,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
         if_chain! {
             if let ExprKind::Binary(Spanned { node: BinOpKind::Div, .. }, ref left, ref right) = expr.node;
             if let ExprKind::MethodCall(ref method_path, _ , ref args) = left.node;
-            if match_type(cx, walk_ptrs_ty(cx.tables.expr_ty(&args[0])), &*paths::DURATION);
+            if match_type(cx, walk_ptrs_ty(cx.tables.expr_ty(&args[0])), &paths::DURATION);
             if let Some((Constant::Int(divisor), _)) = constant(cx, cx.tables, right);
             then {
                 let suggested_fn = match (method_path.ident.as_str().as_ref(), divisor) {