less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Remove duplicate length check from expression.genCSS()

Open Krinkle opened this issue 8 months ago • 0 comments

What:

Remove redundant code.

Credit to @anny21 who found this at https://gerrit.wikimedia.org/r/1129964, https://github.com/wikimedia/less.php/commit/bed2c0cd7b2f0b3fab304db679d122f415404a0d.

Why:

Follows-up 53f84f02bad6e, which added the conditional with a check for i + 1 < this.value.length, which is duplicated from the parent conditional that guruantees the same already with nothing in-between for it to change.

As redundancy, this is inefficient, and its presence could also be confusing to future maintainers.

Checklist:

  • [x] Documentation, N/A
  • [x] Added/updated unit tests, N/A
  • [x] Code complete

Krinkle avatar Mar 21 '25 00:03 Krinkle