Inspectopedia
 
2024.3

Redundant second index in slices

Warning
Code Style
New
Last modified: 03 December 2024

Reports a redundant second index (a high bound) in slice expressions.

Usually, the second index is optional. If you remove it, you might improve code readability.

Example:

You can apply the Remove redundant index quick-fix to such cases. After the quick-fix is applied, this code looks as follows: