manual-pop-if Prefer Array.popIf over conditionally popping the last element Testing an array's last element before popping it performs two separate accesses to the same element. Instead, you SHOULD use popIf to test and remove the last element together. - Category: style - Level: warning - Fix: suggestion - Scope: module Reported function popExpected(values: int32[], expected: int32): int32 | undefined { return values.last() === expected ? values.pop() : undefined; } Accepted function popExpected(values: int32[], expected: int32): int32 | undefined { return values.popIf((value) => value === expected); } Prior art - Clippy ยท manualpopif language/linter/src/rules/style/manualpopif.rs:8