-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
Warns when a SAFETY comment is left on a safe function, trait etc.
What is the advantage of the recommended code over the original code
Avoids users accidentally using unsafe code in an inappropriate fashion because it's marked safe.
Drawbacks
Won't work on normal comments, see #4828.
Example
/// Safety: This function must be used very carefully
pub fn my_fn(){
}
Should be written as:
/// Safety: This function must be used very carefully
pub unsafe fn my_fn(){
}
Here's an example of where this slipped through into real code.
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints