mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-18 10:48:36 +00:00
c6a91df838
We skip the lint if the `loop {}` is in the `#[panic_handler]` as the main recommendation we give is to panic, which obviously isn't possible in a panic handler. Signed-off-by: Joe Richey <joerichey@google.com>
27 lines
523 B
Rust
27 lines
523 B
Rust
// ignore-macos
|
|
// ignore-windows
|
|
|
|
#![warn(clippy::empty_loop)]
|
|
#![feature(lang_items, link_args, start, libc)]
|
|
#![link_args = "-nostartfiles"]
|
|
#![no_std]
|
|
|
|
use core::panic::PanicInfo;
|
|
|
|
#[start]
|
|
fn main(argc: isize, argv: *const *const u8) -> isize {
|
|
// This should trigger the lint
|
|
loop {}
|
|
}
|
|
|
|
#[panic_handler]
|
|
fn panic(_info: &PanicInfo) -> ! {
|
|
// This should NOT trigger the lint
|
|
loop {}
|
|
}
|
|
|
|
#[lang = "eh_personality"]
|
|
extern "C" fn eh_personality() {
|
|
// This should also trigger the lint
|
|
loop {}
|
|
}
|