Enable flake8-comprehension ruff checks
### Feature request

* Ruff was recently added as a linter to huggingface transformers. It provides support out of the box for flake8-comprehension checks which improve list/set/dict comprehensions in Python and make them more readable and faster. Additionally, ruff has autofixits for all these rules so applying them automatically to the codebase is really straightforward and should improve the style of the codebase and make it more readable.

### Motivation

Better Faster / Improved Code

### Your contribution

Applying flake8-comprehension linter to library and enabling it.