2 Checks for `unsafe` blocks and impls without a `// SAFETY: ` comment
3 explaining why the unsafe operations performed inside
6 Note the comment must appear on the line(s) preceding the unsafe block
7 with nothing appearing in between. The following is ok:
11 // This is a valid safety comment
15 But neither of these are:
18 // This is not a valid safety comment
20 /* SAFETY: Neither is this */ unsafe { *x },
25 Undocumented unsafe blocks and impls can make it difficult to
26 read and maintain code, as well as uncover unsoundness
31 use std::ptr::NonNull;
34 let ptr = unsafe { NonNull::new_unchecked(a) };
38 use std::ptr::NonNull;
41 // SAFETY: references are guaranteed to be non-null.
42 let ptr = unsafe { NonNull::new_unchecked(a) };