3

missing_safety_doc: Handle 'implementation safety' headers as well by Manisheart...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/7856
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Collaborator

rust-highfive commented 7 days ago

r? @xFrednet

(rust-highfive has picked a reviewer for you, use r? to override)

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 {

Would it maybe be better to have one let text = text.trim().to_lowercase() and use that for all comparisons? (I'm not certain if these are defined headings by rustdoc or just by us). The changes look fine otherwise upside_down_face

Copy link

Member

Author

@Manishearth Manishearth 7 days ago

to_lowercase() needs it to be allocated unfortunately (and trim does not)

Copy link

Member

Author

@Manishearth Manishearth 7 days ago

Factored the text.trim() out

Alright +1, just for future reference. Does rustdoc actually display these headlines differently, or are they basically a community / Clippy convention? upside_down_face


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK