From bc76e59c3ef3fc54c2190d6bd3d0459ca2334ed7 Mon Sep 17 00:00:00 2001
From: Vincent Lafeychine <vincent.lafeychine@proton.me>
Date: Sun, 14 Apr 2024 19:32:25 +0200
Subject: [PATCH] clippy: Fix never_loop

---
 rr_frontend/.cargo/config.toml               | 1 -
 rr_frontend/translation/src/function_body.rs | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml
index e77f7e0a..f282d771 100644
--- a/rr_frontend/.cargo/config.toml
+++ b/rr_frontend/.cargo/config.toml
@@ -27,7 +27,6 @@ rustflags = [
     "-Aclippy::useless_format",
 
     # clippy::correctness
-    "-Aclippy::never_loop",
     "-Aclippy::option_env_unwrap",
     "-Aclippy::redundant_locals",
     "-Aclippy::unused_io_amount",
diff --git a/rr_frontend/translation/src/function_body.rs b/rr_frontend/translation/src/function_body.rs
index 69c165e5..f6d7cc84 100644
--- a/rr_frontend/translation/src/function_body.rs
+++ b/rr_frontend/translation/src/function_body.rs
@@ -2068,10 +2068,9 @@ impl<'a, 'def: 'a, 'tcx: 'def> BodyTranslator<'a, 'def, 'tcx> {
                         panic!("unconstrained lifetime");
                     } else if rs.len() == 1 {
                         // this is really just an equality constraint
-                        for r2 in rs.iter() {
+                        if let Some(r2) = rs.iter().next() {
                             let lft2 = self.format_region(*r2);
                             stmt_annots.push(radium::Annotation::CopyLftName(lft2, lft));
-                            break;
                         }
                     } else {
                         // a proper intersection
-- 
GitLab