Make some matches exhaustive to avoid bugs, fix tools
This commit is contained in:
parent
a208bae00e
commit
44911b7c67
8 changed files with 71 additions and 45 deletions
|
|
@ -566,7 +566,8 @@ pub fn eq_fn_sig(l: &FnSig, r: &FnSig) -> bool {
|
|||
fn eq_opt_coroutine_kind(l: Option<CoroutineKind>, r: Option<CoroutineKind>) -> bool {
|
||||
match (l, r) {
|
||||
(Some(CoroutineKind::Async { .. }), Some(CoroutineKind::Async { .. }))
|
||||
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. })) => true,
|
||||
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. }))
|
||||
| (Some(CoroutineKind::AsyncGen { .. }), Some(CoroutineKind::AsyncGen { .. })) => true,
|
||||
(None, None) => true,
|
||||
_ => false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ fn rewrite_closure_fn_decl(
|
|||
let coro = match coroutine_kind {
|
||||
Some(ast::CoroutineKind::Async { .. }) => "async ",
|
||||
Some(ast::CoroutineKind::Gen { .. }) => "gen ",
|
||||
Some(ast::CoroutineKind::AsyncGen { .. }) => "async gen ",
|
||||
None => "",
|
||||
};
|
||||
let mover = if matches!(capture, ast::CaptureBy::Value { .. }) {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ pub(crate) fn format_coro(coroutine_kind: &ast::CoroutineKind) -> &'static str {
|
|||
match coroutine_kind {
|
||||
ast::CoroutineKind::Async { .. } => "async ",
|
||||
ast::CoroutineKind::Gen { .. } => "gen ",
|
||||
ast::CoroutineKind::AsyncGen { .. } => "async gen ",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue