manual-strip Prefer prefix or suffix stripping over checking and slicing Checking a string boundary before slicing it repeats the affix and its length across two operations. Instead, you SHOULD use stripPrefix or stripSuffix to test and return the remainder together. - Category: style - Level: warning - Fix: automatic - Scope: module Reported function removePrefix(text: string, prefix: string): string | undefined { return text.startsWith(prefix) ? text.slice(prefix.length) : undefined; } Accepted function removePrefix(text: string, prefix: string): string | undefined { return text.stripPrefix(prefix); } Prior art - Clippy ยท manualstrip language/linter/src/rules/style/manualstrip.rs:8