This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-6
lines changed Expand file tree Collapse file tree 1 file changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use rustc_ast_pretty::pprust::PrintState;
5
5
use rustc_middle:: ty:: TyCtxt ;
6
6
use rustc_session:: parse:: ParseSess ;
7
7
use rustc_span:: source_map:: FilePathMapping ;
8
- use rustc_span:: symbol:: Symbol ;
8
+ use rustc_span:: symbol:: { kw , Symbol } ;
9
9
10
10
/// Render a macro matcher in a format suitable for displaying to the user
11
11
/// as part of an item declaration.
@@ -181,11 +181,38 @@ fn print_tts(printer: &mut Printer<'_>, tts: &TokenStream) {
181
181
// `f(0)` (no space between ident and paren) from tokens resembling `if let (0,
182
182
// 0) = x` (space between ident and paren).
183
183
fn usually_needs_space_between_keyword_and_open_delim ( symbol : Symbol ) -> bool {
184
- match symbol. as_str ( ) {
185
- "as" | "box" | "break" | "const" | "continue" | "crate" | "else" | "enum" | "extern"
186
- | "for" | "if" | "impl" | "in" | "let" | "loop" | "macro" | "match" | "mod" | "move"
187
- | "mut" | "ref" | "return" | "static" | "struct" | "trait" | "type" | "unsafe" | "use"
188
- | "where" | "while" | "yield" => true ,
184
+ match symbol {
185
+ kw:: As
186
+ | kw:: Box
187
+ | kw:: Break
188
+ | kw:: Const
189
+ | kw:: Continue
190
+ | kw:: Crate
191
+ | kw:: Else
192
+ | kw:: Enum
193
+ | kw:: Extern
194
+ | kw:: For
195
+ | kw:: If
196
+ | kw:: Impl
197
+ | kw:: In
198
+ | kw:: Let
199
+ | kw:: Loop
200
+ | kw:: Macro
201
+ | kw:: Match
202
+ | kw:: Mod
203
+ | kw:: Move
204
+ | kw:: Mut
205
+ | kw:: Ref
206
+ | kw:: Return
207
+ | kw:: Static
208
+ | kw:: Struct
209
+ | kw:: Trait
210
+ | kw:: Type
211
+ | kw:: Unsafe
212
+ | kw:: Use
213
+ | kw:: Where
214
+ | kw:: While
215
+ | kw:: Yield => true ,
189
216
_ => false ,
190
217
}
191
218
}
You can’t perform that action at this time.
0 commit comments