Are there any valid cases where one would make a function unsafe even though it contains no unsafe expressions? If not, I feel it would be good to produce a lint warning against it, in the same way we do for unsafe blocks without unsafe expressions.
If I write:
fn foo() {
unsafe { just_safe_stuff(); }
}
The compiler will tell me
|
2 | unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: #[warn(unused_unsafe)] on by default
But if I write
unsafe fn foo() {
just_safe_stuff();
}
The compiler says nothing.
Any arguments for or against creating a new warn-by-default unused_unsafe_fn lint?