Checking that we are not missing any `// SAFETY` comments in our `unsafe` blocks is something we have wanted to do for a long time, as well as cleaning up the remaining cases that were not documented [1]. Back when Rust for Linux started, this was something that could have been done via a script, like Rust's `tidy`. Soon after, in Rust 1.58.0, Clippy implemented the `undocumented_unsafe_blocks` lint [2]. Even though the lint has a few false positives, e.g. in some cases where attributes appear between the comment and the `unsafe` block [3], there are workarounds and the lint seems quite usable already. Thus enable the lint now. We still have a few cases to clean up, so just allow those for the moment by writing a `TODO` comment -- some of those may be good candidates for new contributors.
Showing the changes to rust/uapi (1 of 16 files). Show all
Unified · Split
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))] | 14 | #![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))] |
| 15 | #![allow( | 15 | #![allow( |
| 16 | clippy::all, | 16 | clippy::all, |
| 17 | clippy::undocumented_unsafe_blocks, | ||
| 17 | dead_code, | 18 | dead_code, |
| 18 | missing_docs, | 19 | missing_docs, |
| 19 | non_camel_case_types, | 20 | non_camel_case_types, |