@@ -441,14 +441,14 @@ impl Parser {
441441
442442 fn delimited_comma_separated < T > (
443443 & mut self ,
444- open : Token ,
445- close : Token ,
444+ open : & Token ,
445+ close : & Token ,
446446 parse_item : fn ( & mut Self ) -> Result < T , Error > ,
447447 allow_empty : bool ,
448448 ) -> Result < ( Vec < T > , Span ) , Error > {
449- let open_span = self . require_current_token_matches ( & open) ?. span ;
449+ let open_span = self . require_current_token_matches ( open) ?. span ;
450450
451- if let Some ( close_token) = self . consume_token_if ( & [ close . clone ( ) ] ) {
451+ if let Some ( close_token) = self . consume_token_if ( std :: slice :: from_ref ( close ) ) {
452452 if allow_empty {
453453 return Ok ( ( Vec :: new ( ) , open_span. merge ( close_token. span ) ) ) ;
454454 }
@@ -463,14 +463,14 @@ impl Parser {
463463 let mut items = vec ! [ parse_item( self ) ?] ;
464464
465465 while self . consume_token_if ( & [ Token :: Comma ] ) . is_some ( ) {
466- if self . match_token ( & [ close . clone ( ) ] ) . is_some ( ) {
466+ if self . match_token ( std :: slice :: from_ref ( close ) ) . is_some ( ) {
467467 break ;
468468 }
469469
470470 items. push ( parse_item ( self ) ?) ;
471471 }
472472
473- let close_span = self . require_current_token_matches ( & close) ?. span ;
473+ let close_span = self . require_current_token_matches ( close) ?. span ;
474474 Ok ( ( items, open_span. merge ( close_span) ) )
475475 }
476476
@@ -480,8 +480,8 @@ impl Parser {
480480 next : fn ( & mut Self ) -> Result < ExpressionLocation , Error > ,
481481 ) -> Result < ExpressionLocation , Error > {
482482 let ( values, span) = self . delimited_comma_separated (
483- Token :: LeftParentheses ,
484- Token :: RightParentheses ,
483+ & Token :: LeftParentheses ,
484+ & Token :: RightParentheses ,
485485 next,
486486 true ,
487487 ) ?;
@@ -1343,7 +1343,7 @@ impl Parser {
13431343
13441344 match token {
13451345 Token :: Identifier ( _) => self . named_or_generic_type ( ) ,
1346- Token :: LeftCurlyBracket => self . tuple_type ( ) ,
1346+ Token :: LeftParentheses => self . tuple_type ( ) ,
13471347 _ => Err ( Error :: with_help (
13481348 format ! ( "expected a type annotation, found `{token}`" ) ,
13491349 * span,
@@ -1362,7 +1362,7 @@ impl Parser {
13621362 } ;
13631363
13641364 let generic_args = if self . peek_current_token ( ) == Some ( & Token :: Less ) {
1365- self . delimited_comma_separated ( Token :: Less , Token :: Greater , Self :: static_type, false ) ?
1365+ self . delimited_comma_separated ( & Token :: Less , & Token :: Greater , Self :: static_type, false ) ?
13661366 . 0
13671367 } else {
13681368 Vec :: new ( )
@@ -1373,7 +1373,13 @@ impl Parser {
13731373 }
13741374
13751375 pub fn tuple_type ( & mut self ) -> Result < StaticType , Error > {
1376- todo ! ( )
1376+ let ( types, _span) = self . delimited_comma_separated (
1377+ & Token :: LeftParentheses ,
1378+ & Token :: RightParentheses ,
1379+ Self :: static_type,
1380+ true ,
1381+ ) ?;
1382+ Ok ( StaticType :: Tuple ( types) )
13771383 }
13781384
13791385 fn peek_range_end ( & self ) -> bool {
0 commit comments