-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
133 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,25 @@ | ||
/// 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!(); | ||
} | ||
|
||
/// This is a private function, so docs aren't necessary | ||
unsafe fn you_dont_see_me() { | ||
unimplemented!(); | ||
} | ||
|
||
fn main() { | ||
you_dont_see_me(); | ||
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 | ||
|