private static void unwrapExpression(@NotNull PsiSwitchExpression switchExpression) {
    PsiCodeBlock body = switchExpression.getBody();
    if (body == null) return;
    PsiStatement[] statements = body.getStatements();
    if (statements.length != 1 || !(statements[0] instanceof PsiSwitchLabeledRuleStatement rule)) return;
    PsiStatement ruleBody = rule.getBody();
    if (!(ruleBody instanceof PsiExpressionStatement)) return;
    CodeBlockSurrounder surrounder = CodeBlockSurrounder.forExpression(switchExpression);
    if (surrounder != null) {
      CodeBlockSurrounder.SurroundResult surroundResult = surrounder.surround();
      switchExpression = (PsiSwitchExpression)surroundResult.getExpression();
      rule = (PsiSwitchLabeledRuleStatement)Objects.requireNonNull(switchExpression.getBody()).getStatements()[0];
      ruleBody = rule.getBody();
      if (ruleBody == null) return;
      PsiCaseLabelElement label = Objects.requireNonNull(rule.getCaseLabelElementList()).getElements()[0];
      List<PsiLocalVariable> variables = collectVariables(label, switchExpression);
      if (variables.isEmpty()) {
        new CommentTracker().replaceAndRestoreComments(switchExpression, ((PsiExpressionStatement)ruleBody).getExpression());
        surroundResult.collapse();
        return;
      }
      new CommentTracker().replaceAndRestoreComments(switchExpression, ((PsiExpressionStatement)ruleBody).getExpression());
      variables.replaceAll(variable -> addVariable(variable, surroundResult.getAnchor(), surroundResult.getAnchor().getParent()));
      inline(variables, surroundResult.getAnchor().getParent());
    }
  }
private static void unwrapExpression(@NotNull PsiSwitchExpression switchExpression)