1 // aux-build:macro_rules.rs 2 3 #![warn(clippy::empty_loop)] 4 5 #[macro_use] 6 extern crate macro_rules; 7 should_trigger()8fn should_trigger() { 9 loop {} 10 loop { 11 loop {} 12 } 13 14 'outer: loop { 15 'inner: loop {} 16 } 17 } 18 should_not_trigger()19fn should_not_trigger() { 20 loop { 21 panic!("This is fine") 22 } 23 let ten_millis = std::time::Duration::from_millis(10); 24 loop { 25 std::thread::sleep(ten_millis) 26 } 27 28 #[allow(clippy::never_loop)] 29 'outer: loop { 30 'inner: loop { 31 break 'inner; 32 } 33 break 'outer; 34 } 35 36 // Make sure `allow` works for this lint 37 #[allow(clippy::empty_loop)] 38 loop {} 39 40 // We don't lint loops inside macros 41 macro_rules! foo { 42 () => { 43 loop {} 44 }; 45 } 46 47 // We don't lint external macros 48 foofoo!() 49 } 50 main()51fn main() {} 52