mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 03:54:42 +00:00 
			
		
		
		
	revert blocklike changes
This commit is contained in:
		
							parent
							
								
									e3deeec2f2
								
							
						
					
					
						commit
						2ac6cb1521
					
				
					 3 changed files with 9 additions and 8 deletions
				
			
		|  | @ -204,9 +204,8 @@ impl BlockLike { | ||||||
|         self == BlockLike::Block |         self == BlockLike::Block | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn is_blocklike(expr: &CompletedMarker, p: &Parser<'_>) -> bool { |     fn is_blocklike(kind: SyntaxKind) -> bool { | ||||||
|         matches!(expr.kind(), BLOCK_EXPR | IF_EXPR | WHILE_EXPR | FOR_EXPR | LOOP_EXPR | MATCH_EXPR) |         matches!(kind, BLOCK_EXPR | IF_EXPR | WHILE_EXPR | FOR_EXPR | LOOP_EXPR | MATCH_EXPR) | ||||||
|             || (expr.last_token(p) == Some(T!['}']) && !matches!(expr.kind(), CLOSURE_EXPR)) |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -134,10 +134,12 @@ pub(super) fn let_stmt(p: &mut Parser<'_>, with_semi: Semicolon) { | ||||||
|         // test_err let_else_right_curly_brace
 |         // test_err let_else_right_curly_brace
 | ||||||
|         // fn func() { let Some(_) = {Some(1)} else { panic!("h") };}
 |         // fn func() { let Some(_) = {Some(1)} else { panic!("h") };}
 | ||||||
|         if let Some(expr) = expr_after_eq { |         if let Some(expr) = expr_after_eq { | ||||||
|             if BlockLike::is_blocklike(&expr, p) { |             if let Some(token) = expr.last_token(p) { | ||||||
|                 p.error( |                 if token == T!['}'] { | ||||||
|                     "right curly brace `}` before `else` in a `let...else` statement not allowed", |                     p.error( | ||||||
|                 ) |                         "right curly brace `}` before `else` in a `let...else` statement not allowed" | ||||||
|  |                     ) | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -198,7 +198,7 @@ pub(super) fn atom_expr( | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|     let blocklike = |     let blocklike = | ||||||
|         if BlockLike::is_blocklike(&done, p) { BlockLike::Block } else { BlockLike::NotBlock }; |         if BlockLike::is_blocklike(done.kind()) { BlockLike::Block } else { BlockLike::NotBlock }; | ||||||
|     Some((done, blocklike)) |     Some((done, blocklike)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 jnyfah
						jnyfah