mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Don't check sad pattern equality by text
This commit is contained in:
		
							parent
							
								
									251f0c6090
								
							
						
					
					
						commit
						eb3f90b301
					
				@ -265,10 +265,11 @@ fn binds_name(pat: &ast::Pat) -> bool {
 | 
				
			|||||||
        _ => false,
 | 
					        _ => false,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn is_sad_pat(sema: &hir::Semantics<RootDatabase>, pat: &ast::Pat) -> bool {
 | 
					fn is_sad_pat(sema: &hir::Semantics<RootDatabase>, pat: &ast::Pat) -> bool {
 | 
				
			||||||
    sema.type_of_pat(pat)
 | 
					    sema.type_of_pat(pat)
 | 
				
			||||||
        .and_then(|ty| TryEnum::from_ty(sema, &ty))
 | 
					        .and_then(|ty| TryEnum::from_ty(sema, &ty))
 | 
				
			||||||
        .map_or(false, |it| it.sad_pattern().syntax().text() == pat.syntax().text())
 | 
					        .map_or(false, |it| does_pat_match_variant(pat, &it.sad_pattern()))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user