mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
28 lines
613 B
Rust
28 lines
613 B
Rust
//@compile-flags: -Clink-arg=-nostartfiles
|
|
//@ignore-target: apple
|
|
|
|
#![warn(clippy::empty_loop)]
|
|
#![feature(lang_items, start, libc)]
|
|
#![no_std]
|
|
|
|
use core::panic::PanicInfo;
|
|
|
|
#[start]
|
|
fn main(argc: isize, argv: *const *const u8) -> isize {
|
|
// This should trigger the lint
|
|
loop {}
|
|
//~^ ERROR: empty `loop {}` wastes CPU cycles
|
|
}
|
|
|
|
#[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 {}
|
|
//~^ ERROR: empty `loop {}` wastes CPU cycles
|
|
}
|