When I run clippy on this:
#[target_feature(enable = "avx")] pub fn f() {} I get a warning:
warning: unsafe function's docs are missing a `# Safety` section --> src/lib.rs:2:1 | 2 | pub fn f() {} | ^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#missing_safety_doc = note: `#[warn(clippy::missing_safety_doc)]` on by default Given that calling target_feature functions are no longer unsafe and can be safely called from other target_feature functions since Rust 1.86, it seems inappropriate to add such Safety comments. It would be the same comment for all target_feature functions, so it is redundant information.
A better solution would be that rustdoc shows required target_features. Unfortunately this is currently only available on nightly and behind a feature.
3 posts - 2 participants