mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Auto merge of #7856 - Manishearth:impl-safety, r=xFrednet
missing_safety_doc: Handle 'implementation safety' headers as well We hit some FPs on this in `yoke`, it's somewhat normal to mark trait impl safety with "implementation safety". We could also broaden the check for headers which contain the word "safety" somehow, or split out impl safety stuff to only apply to traits. changelog: handle 'implementation safety' headers in `missing_safety_doc`
This commit is contained in:
commit
df65291edd
2 changed files with 11 additions and 3 deletions
|
@ -578,9 +578,12 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
// text "http://example.com" by pulldown-cmark
|
||||
continue;
|
||||
}
|
||||
headers.safety |= in_heading && text.trim() == "Safety";
|
||||
headers.errors |= in_heading && text.trim() == "Errors";
|
||||
headers.panics |= in_heading && text.trim() == "Panics";
|
||||
let trimmed_text = text.trim();
|
||||
headers.safety |= in_heading && trimmed_text == "Safety";
|
||||
headers.safety |= in_heading && trimmed_text == "Implementation safety";
|
||||
headers.safety |= in_heading && trimmed_text == "Implementation Safety";
|
||||
headers.errors |= in_heading && trimmed_text == "Errors";
|
||||
headers.panics |= in_heading && trimmed_text == "Panics";
|
||||
if in_code {
|
||||
if is_rust {
|
||||
let edition = edition.unwrap_or_else(|| cx.tcx.sess.edition());
|
||||
|
|
|
@ -125,3 +125,8 @@ pub mod __macro {
|
|||
pub unsafe fn f() {}
|
||||
}
|
||||
}
|
||||
|
||||
/// # Implementation safety
|
||||
pub unsafe trait DocumentedUnsafeTraitWithImplementationHeader {
|
||||
fn method();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue