mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Don't lint needless_return
in fns across a macro boundary
This commit is contained in:
parent
54fa92287b
commit
d24f0d056f
2 changed files with 14 additions and 0 deletions
|
@ -174,6 +174,10 @@ impl<'tcx> LateLintPass<'tcx> for Return {
|
|||
sp: Span,
|
||||
_: LocalDefId,
|
||||
) {
|
||||
if sp.from_expansion() {
|
||||
return;
|
||||
}
|
||||
|
||||
match kind {
|
||||
FnKind::Closure => {
|
||||
// when returning without value in closure, replace this `return`
|
||||
|
|
|
@ -169,4 +169,14 @@ mod issue_5729 {
|
|||
}
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/11167
|
||||
macro_rules! fn_in_macro {
|
||||
($b:block) => {
|
||||
fn f() -> usize $b
|
||||
}
|
||||
}
|
||||
fn_in_macro!({
|
||||
return 1;
|
||||
});
|
||||
|
||||
fn main() {}
|
||||
|
|
Loading…
Reference in a new issue