refactor: avoid List.length
when match
suffices
#2776
Merged
List.length
when match
suffices
#2776