diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 9aa066370bb..969ff522f61 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -156,24 +156,13 @@ fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool { } } match tt { - TokenTree::Token(token) => match token.kind { - token::Comma => false, - _ => true, - }, - TokenTree::Delimited(_, DelimToken::Paren, _) => match prev { - TokenTree::Token(token) => match token.kind { - token::Ident(_, _) => false, - _ => true, - }, - _ => true, - }, - TokenTree::Delimited(_, DelimToken::Bracket, _) => match prev { - TokenTree::Token(token) => match token.kind { - token::Pound => false, - _ => true, - }, - _ => true, - }, + TokenTree::Token(token) => token.kind != token::Comma, + TokenTree::Delimited(_, DelimToken::Paren, _) => { + !matches!(prev, TokenTree::Token(Token { kind: token::Ident(..), .. })) + } + TokenTree::Delimited(_, DelimToken::Bracket, _) => { + !matches!(prev, TokenTree::Token(Token { kind: token::Pound, .. })) + } TokenTree::Delimited(..) => true, } }