File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -873,12 +873,11 @@ pub fn is_automatically_derived(attrs: &[ast::Attribute]) -> bool {
873
873
///
874
874
/// Ie. `x`, `{ x }` and `{{{{ x }}}}` all give `x`. `{ x; y }` and `{}` return
875
875
/// themselves.
876
- pub fn remove_blocks < ' tcx > ( expr : & ' tcx Expr < ' tcx > ) -> & ' tcx Expr < ' tcx > {
877
- if let ExprKind :: Block ( ref block, _) = expr. kind {
878
- if block. stmts . is_empty ( ) {
879
- if let Some ( ref expr) = block. expr {
880
- return remove_blocks ( expr) ;
881
- }
876
+ pub fn remove_blocks < ' tcx > ( mut expr : & ' tcx Expr < ' tcx > ) -> & ' tcx Expr < ' tcx > {
877
+ while let ExprKind :: Block ( ref block, ..) = expr. kind {
878
+ match ( block. stmts . is_empty ( ) , block. expr . as_ref ( ) ) {
879
+ ( true , Some ( e) ) => expr = e,
880
+ _ => break ,
882
881
}
883
882
}
884
883
expr
You can’t perform that action at this time.
0 commit comments