about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/missing_spin_loop_no_std.fixed
blob: a525d414670ee5ef07c634d54c3949fc46fb36ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(clippy::missing_spin_loop)]
#![crate_type = "lib"]
#![no_std]

use core::sync::atomic::{AtomicBool, Ordering};

pub fn main(_argc: isize, _argv: *const *const u8) -> isize {
    // This should trigger the lint
    let b = AtomicBool::new(true);
    // This should lint with `core::hint::spin_loop()`
    while b.load(Ordering::Acquire) { core::hint::spin_loop() }
    //~^ missing_spin_loop
    0
}