Repository: huggingface/transformers
Pull request: Fix: remove the redundant snippet of _whole_word_mask

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

I noticed that `cand_indexes` is constructed using the following logic:
```python
cand_indexes = []
for i, token in enumerate(input_tokens):
    if token == "[CLS]" or token == "[SEP]":
        continue

    if len(cand_indexes) >= 1 and token.startswith("##"):
        cand_indexes[-1].append(i)
    else:
        cand_indexes.append([i])
```
Since `i` is directly obtained from `enumerate(input_tokens)`, it is guaranteed to be unique across iterations. As a result, there will be no duplicate elements in the flattened `cand_indexes`.

Given this, the following check appears to be redundant, as it will never be triggered:
```python
is_any_index_covered = False
for index in index_set:
    if index in covered_indexes:
        is_any_index_covered = True
        break
if is_any_index_covered:
    continue
```
I suggest removing this redundant check to simplify the logic and improve efficiency and readability. 
Let me know if there’s any edge case I might have missed!

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

- text models: @ArthurZucker 
- original code reviewer: @LysandreJik 

Changed files:
filename: src/transformers/data/data_collator.py
patch: @@ -1216,13 +1216,6 @@ def _whole_word_mask(self, input_tokens: List[str], max_predictions=512):
             # predictions, then just skip this candidate.
             if len(masked_lms) + len(index_set) > num_to_predict:
                 continue
-            is_any_index_covered = False
-            for index in index_set:
-                if index in covered_indexes:
-                    is_any_index_covered = True
-                    break
-            if is_any_index_covered:
-                continue
             for index in index_set:
                 covered_indexes.add(index)
                 masked_lms.append(index)