Skip to content

infinite-loop and never_loop trigger on the same loop 😆 #16134

@matthiaskrgr

Description

@matthiaskrgr
#![warn(clippy::infinite_loop, clippy::never_loop)]
fn main() {
    'outer2: loop {
        let _: i32 = loop { loop { break 'outer2 } };
    }
}
...
warning: this loop never actually loops
 --> a.rs:4:22
  |
4 |         let _: i32 = loop { loop { break 'outer2 } };
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop

warning: infinite loop detected
 --> a.rs:4:22
  |
4 |         let _: i32 = loop { loop { break 'outer2 } };
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#infinite_loop
note: the lint level is defined here
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions