mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Use closure body span (fixes #1405)
This commit is contained in:
parent
57e056dfc7
commit
cdfe002ee1
2 changed files with 5 additions and 1 deletions
|
@ -138,7 +138,7 @@ impl EarlyLintPass for ReturnPass {
|
||||||
match kind {
|
match kind {
|
||||||
FnKind::ItemFn(.., block) |
|
FnKind::ItemFn(.., block) |
|
||||||
FnKind::Method(.., block) => self.check_block_return(cx, block),
|
FnKind::Method(.., block) => self.check_block_return(cx, block),
|
||||||
FnKind::Closure(body) => self.check_final_expr(cx, body, None),
|
FnKind::Closure(body) => self.check_final_expr(cx, body, Some(body.span)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ fn test_closure() {
|
||||||
//~| HELP remove `return` as shown
|
//~| HELP remove `return` as shown
|
||||||
//~| SUGGESTION true
|
//~| SUGGESTION true
|
||||||
};
|
};
|
||||||
|
let _ = || return true;
|
||||||
|
//~^ ERROR unneeded return statement
|
||||||
|
//~| HELP remove `return` as shown
|
||||||
|
//~| SUGGESTION true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Loading…
Reference in a new issue