1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-06 00:44:23 +02:00

Add safety comment (#1553)

```
error: unsafe block missing a safety comment
  --> interoperability/bindgen/main.rs:11:5
   |
11 |     unsafe {
   |     ^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line
   = help: for further information visit https://rust-lang.github.io/rust-clippy
/master/index.html#undocumented_unsafe_blocks
   = note: requested on the command line with `-D clippy::undocumented-unsafe-bl
ocks`
```
This commit is contained in:
Ning Chen 2023-12-21 05:26:25 -08:00 committed by GitHub
parent 30f8e50b43
commit a9eaa129cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ fn main() {
name: name.as_ptr(),
years: 42,
};
// SAFETY: `print_card` is safe to call with a valid `card` pointer.
unsafe {
print_card(&card as *const card);
}