summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/missing_safety_doc.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/missing_safety_doc.txt')
-rw-r--r--src/tools/clippy/src/docs/missing_safety_doc.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/missing_safety_doc.txt b/src/tools/clippy/src/docs/missing_safety_doc.txt
new file mode 100644
index 000000000..6492eb84f
--- /dev/null
+++ b/src/tools/clippy/src/docs/missing_safety_doc.txt
@@ -0,0 +1,26 @@
+### What it does
+Checks for the doc comments of publicly visible
+unsafe functions and warns if there is no `# Safety` section.
+
+### Why is this bad?
+Unsafe functions should document their safety
+preconditions, so that users can be sure they are using them safely.
+
+### Examples
+```
+/// This function should really be documented
+pub unsafe fn start_apocalypse(u: &mut Universe) {
+ unimplemented!();
+}
+```
+
+At least write a line about safety:
+
+```
+/// # Safety
+///
+/// This function should not be called before the horsemen are ready.
+pub unsafe fn start_apocalypse(u: &mut Universe) {
+ unimplemented!();
+}
+``` \ No newline at end of file