mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-20 19:52:48 +00:00
Don't lint needless_return
in fns across a macro boundary
This commit is contained in:
parent
54fa92287b
commit
d24f0d056f
@ -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 New Issue
Block a user