File tree Expand file tree Collapse file tree 1 file changed +9
-22
lines changed Expand file tree Collapse file tree 1 file changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -158,28 +158,15 @@ fn parse_args(ecx: &mut ExtCtxt,
158
158
} // accept trailing commas
159
159
if named || ( p. token . is_ident ( ) && p. look_ahead ( 1 , |t| * t == token:: Eq ) ) {
160
160
named = true ;
161
- let ident = match p. token {
162
- token:: Ident ( i, _) => {
163
- p. bump ( ) ;
164
- i
165
- }
166
- _ if named => {
167
- ecx. span_err (
168
- p. span ,
169
- "expected ident, positional arguments cannot follow named arguments" ,
170
- ) ;
171
- return None ;
172
- }
173
- _ => {
174
- ecx. span_err (
175
- p. span ,
176
- & format ! (
177
- "expected ident for named argument, found `{}`" ,
178
- p. this_token_to_string( )
179
- ) ,
180
- ) ;
181
- return None ;
182
- }
161
+ let ident = if let token:: Ident ( i, _) = p. token {
162
+ p. bump ( ) ;
163
+ i
164
+ } else {
165
+ ecx. span_err (
166
+ p. span ,
167
+ "expected ident, positional arguments cannot follow named arguments" ,
168
+ ) ;
169
+ return None ;
183
170
} ;
184
171
let name: & str = & ident. as_str ( ) ;
185
172
You can’t perform that action at this time.
0 commit comments