needless_doctest_main: False positive for async fn

Fixes #5188.
This commit is contained in:
Jon Gjengset 2020-02-17 13:47:42 -05:00
parent db2fbb127a
commit e2fc801ad5
No known key found for this signature in database
GPG key ID: FAEA8B761ADA5F4C

View file

@ -424,7 +424,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
headers
}
static LEAVE_MAIN_PATTERNS: &[&str] = &["static", "fn main() {}", "extern crate"];
static LEAVE_MAIN_PATTERNS: &[&str] = &["static", "fn main() {}", "extern crate", "async fn main() {"];
fn check_code(cx: &LateContext<'_, '_>, text: &str, span: Span) {
if text.contains("fn main() {") && !LEAVE_MAIN_PATTERNS.iter().any(|p| text.contains(p)) {