···577577 // argument, allowing further inlining.
578578 let function = self.expression(*function);
579579580580+ // If the left-hand side is in a block for some reason, for example
581581+ // `{ fn(x) { x + 1 } }(10)`, we still want to be able to inline it.
582582+ let function = expand_block(function);
583583+580584 let function = match function {
581585 TypedExpr::Var {
582586 ref constructor,
···903907 clauses,
904908 compiled_case,
905909 }
910910+ }
911911+}
912912+913913+/// Removes any blocks which are acting as brackets (they hold a single expression)
914914+fn expand_block(expression: TypedExpr) -> TypedExpr {
915915+ match expression {
916916+ TypedExpr::Block {
917917+ location,
918918+ statements,
919919+ } if statements.len() == 1 => {
920920+ let first = statements
921921+ .into_iter()
922922+ .next()
923923+ .expect("Vec1 always has a first element");
924924+925925+ match first {
926926+ // If this is several blocks inside each other, we want to
927927+ // expand them all.
928928+ Statement::Expression(inner) => expand_block(inner),
929929+ Statement::Assignment(_) | Statement::Use(_) | Statement::Assert(_) => {
930930+ TypedExpr::Block {
931931+ location,
932932+ statements: Vec1::new(first),
933933+ }
934934+ }
935935+ }
936936+ }
937937+ _ => expression,
906938 }
907939}
908940