]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/undocumented_unsafe_blocks.rs
Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup
[rust.git] / src / tools / clippy / tests / ui / undocumented_unsafe_blocks.rs
index 08aee4332151446a6fdd17603bd651cae7ee7306..cbc6768033ec822bb7b4bfe6447579585a85000d 100644 (file)
@@ -490,4 +490,23 @@ unsafe impl CrateRoot for () {}
 // SAFETY: ok
 unsafe impl CrateRoot for (i32) {}
 
+fn issue_9142() {
+    // SAFETY: ok
+    let _ =
+        // we need this comment to avoid rustfmt putting
+        // it all on one line
+        unsafe {};
+
+    // SAFETY: this is more than one level away, so it should warn
+    let _ = {
+        if unsafe { true } {
+            todo!();
+        } else {
+            let bar = unsafe {};
+            todo!();
+            bar
+        }
+    };
+}
+
 fn main() {}