public void deleteRedundantComments() {
      List<PsiElement> redundantComments = new ArrayList<>();

      List<PsiElement> mightBeRedundantComments = new ArrayList<>();
      for (PsiElement element = myRuleToDelete.myFirstLabel.getNextSibling(); element != null; element = element.getNextSibling()) {
        if (element instanceof PsiWhiteSpace whiteSpace) {
          if (whiteSpace.textContains('\n')) {
            redundantComments.addAll(mightBeRedundantComments);
            break;
          }
        }
        else if (element instanceof PsiComment psiComment) {
          if (isRedundantComment(myCommentsToMergeWith, psiComment)) {
            mightBeRedundantComments.add(psiComment);
          }
        }
      }

      mightBeRedundantComments.clear();
      for (PsiElement element = myRuleToDelete.myFirstLabel.getPrevSibling(); element != null; element = element.getPrevSibling()) {
        if (element instanceof PsiWhiteSpace whiteSpace) {
          if (whiteSpace.textContains('\n')) {
            redundantComments.addAll(mightBeRedundantComments);
            mightBeRedundantComments.clear();
          }
          continue;
        }
        else if (element instanceof PsiComment psiComment) {
          if (isRedundantComment(myCommentsToMergeWith, psiComment)) {
            mightBeRedundantComments.add(psiComment);
            continue;
          }
        }
        break;
      }
      redundantComments.forEach(PsiElement::delete);
    }
public void deleteRedundantComments()