about summary refs log tree commit diff
path: root/clippy_utils/src
diff options
context:
space:
mode:
authory21 <30553356+y21@users.noreply.github.com>2023-04-18 00:14:56 +0200
committery21 <30553356+y21@users.noreply.github.com>2023-04-29 18:59:07 +0200
commit1d08325293f0dcccd29700d6b14755f8fbd5f076 (patch)
tree0bd4b576864abb349a9f408a6b742bbb665a112f /clippy_utils/src
parentbcdcc34ba95cd27cab6da68fcac820ca6968d3e2 (diff)
move lint to loops, emit proper suggestion, more tests
Diffstat (limited to 'clippy_utils/src')
-rw-r--r--clippy_utils/src/higher.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/clippy_utils/src/higher.rs b/clippy_utils/src/higher.rs
index 50bef370930..a61e4c38088 100644
--- a/clippy_utils/src/higher.rs
+++ b/clippy_utils/src/higher.rs
@@ -311,6 +311,8 @@ pub struct While<'hir> {
     pub condition: &'hir Expr<'hir>,
     /// `while` loop body
     pub body: &'hir Expr<'hir>,
+    /// Span of the loop header
+    pub span: Span,
 }
 
 impl<'hir> While<'hir> {
@@ -336,10 +338,10 @@ impl<'hir> While<'hir> {
             },
             _,
             LoopSource::While,
-            _,
+            span,
         ) = expr.kind
         {
-            return Some(Self { condition, body });
+            return Some(Self { condition, body, span });
         }
         None
     }