-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New lint: Require
# Safety
section in pub unsafe fn docs
- Loading branch information
Showing
8 changed files
with
127 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// This is not sufficiently documented | ||
pub unsafe fn destroy_the_planet() { | ||
unimplemented!(); | ||
} | ||
|
||
/// This one is | ||
/// | ||
/// # Safety | ||
/// | ||
/// This function shouldn't be called unless the horsemen are ready | ||
pub unsafe fn apocalypse(universe: &mut ()) { | ||
unimplemented!(); | ||
} | ||
|
||
fn main() { | ||
destroy_the_planet(); | ||
let mut universe = (); | ||
apocalypse(&mut universe); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error: unsafe function's docs miss `# Safety` section | ||
--> $DIR/doc_unsafe.rs:2:1 | ||
| | ||
LL | / pub unsafe fn destroy_the_planet() { | ||
LL | | unimplemented!(); | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: `-D clippy::missing-safety-doc` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|