mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-25 20:07:21 +00:00
Auto merge of #12322 - sanxiyn:expression-with-attribute, r=llogiq
Be careful with expressions with attributes Fix #9949. changelog: [`unused_unit`]: skip expressions with attributes
This commit is contained in:
commit
64054693eb
3 changed files with 15 additions and 0 deletions
|
@ -58,6 +58,7 @@ impl EarlyLintPass for UnusedUnit {
|
||||||
&& let ctxt = block.span.ctxt()
|
&& let ctxt = block.span.ctxt()
|
||||||
&& stmt.span.ctxt() == ctxt
|
&& stmt.span.ctxt() == ctxt
|
||||||
&& expr.span.ctxt() == ctxt
|
&& expr.span.ctxt() == ctxt
|
||||||
|
&& expr.attrs.is_empty()
|
||||||
{
|
{
|
||||||
let sp = expr.span;
|
let sp = expr.span;
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
|
|
|
@ -94,3 +94,10 @@ mod issue9748 {
|
||||||
let _ = for<'a> |_: &'a u32| -> () {};
|
let _ = for<'a> |_: &'a u32| -> () {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod issue9949 {
|
||||||
|
fn main() {
|
||||||
|
#[doc = "documentation"]
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -94,3 +94,10 @@ mod issue9748 {
|
||||||
let _ = for<'a> |_: &'a u32| -> () {};
|
let _ = for<'a> |_: &'a u32| -> () {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod issue9949 {
|
||||||
|
fn main() {
|
||||||
|
#[doc = "documentation"]
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue