Be careful with expressions with attributes

This commit is contained in:
Seo Sanghyeon 2024-02-20 22:18:49 +09:00
parent 6aa5f1ac6f
commit cd45d5a81c
3 changed files with 15 additions and 0 deletions

View File

@ -58,6 +58,7 @@ fn check_block(&mut self, cx: &EarlyContext<'_>, block: &ast::Block) {
&& let ctxt = block.span.ctxt()
&& stmt.span.ctxt() == ctxt
&& expr.span.ctxt() == ctxt
&& expr.attrs.is_empty()
{
let sp = expr.span;
span_lint_and_sugg(

View File

@ -94,3 +94,10 @@ mod issue9748 {
let _ = for<'a> |_: &'a u32| -> () {};
}
}
mod issue9949 {
fn main() {
#[doc = "documentation"]
()
}
}

View File

@ -94,3 +94,10 @@ fn main() {
let _ = for<'a> |_: &'a u32| -> () {};
}
}
mod issue9949 {
fn main() {
#[doc = "documentation"]
()
}
}