about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-10-21 08:50:50 -0700
committerManish Goregaokar <manishsmail@gmail.com>2021-10-21 08:50:50 -0700
commit1e8d9fb18c5bba7577cea524282dd5cbbc7ec702 (patch)
tree116ba2ae8b0eddec4d4f26c98bbad40325e1e756
parent91496c2ac6abf6454c413bb23e8becf6b6dc20ea (diff)
downloadrust-1e8d9fb18c5bba7577cea524282dd5cbbc7ec702.tar.gz
rust-1e8d9fb18c5bba7577cea524282dd5cbbc7ec702.zip
Handle 'implementation safety' headers as well
-rw-r--r--clippy_lints/src/doc.rs2
-rw-r--r--tests/ui/doc_unsafe.rs5
2 files changed, 7 insertions, 0 deletions
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs
index 5511c3ea9b6..c14a3604c2f 100644
--- a/clippy_lints/src/doc.rs
+++ b/clippy_lints/src/doc.rs
@@ -579,6 +579,8 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
                     continue;
                 }
                 headers.safety |= in_heading && text.trim() == "Safety";
+                headers.safety |= in_heading && text.trim() == "Implementation safety";
+                headers.safety |= in_heading && text.trim() == "Implementation Safety";
                 headers.errors |= in_heading && text.trim() == "Errors";
                 headers.panics |= in_heading && text.trim() == "Panics";
                 if in_code {
diff --git a/tests/ui/doc_unsafe.rs b/tests/ui/doc_unsafe.rs
index 03bb30f9083..4464a21b3b6 100644
--- a/tests/ui/doc_unsafe.rs
+++ b/tests/ui/doc_unsafe.rs
@@ -125,3 +125,8 @@ pub mod __macro {
         pub unsafe fn f() {}
     }
 }
+
+/// # Implementation safety
+pub unsafe trait DocumentedUnsafeTraitWithImplementationHeader {
+    fn method();
+}