fix RedundantLocals clippy caused by async and await
This commit is contained in:
parent
75b9f53e47
commit
ac25636a8f
2 changed files with 22 additions and 3 deletions
|
@ -463,3 +463,12 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
|
|||
ExpnKind::Macro { .. } => true, // definitely a plugin
|
||||
}
|
||||
}
|
||||
|
||||
/// Return whether `span` is generated by `async` or `await`.
|
||||
pub fn is_from_async_await(span: Span) -> bool {
|
||||
let expn_data = span.ctxt().outer_expn_data();
|
||||
match expn_data.kind {
|
||||
ExpnKind::Desugaring(DesugaringKind::Async | DesugaringKind::Await) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue