branches-sharing-code Extract identical branch prefixes or suffixes The same checked statements occur at the corresponding prefix or suffix of every branch. Instead, you SHOULD extract the repetition while preserving condition evaluation, branch scope, and drop order. - Category: style - Level: warning - Fix: none - Scope: module Reported declare function record(value: string): void; declare function flush(): void; function finish(condition: boolean): void { if (condition) { record("left"); flush(); } else { record("right"); flush(); } } Accepted declare function record(value: string): void; declare function flush(): void; function finish(condition: boolean): void { if (condition) { record("left"); } else { record("right"); } flush(); } Prior art - Clippy ยท branchessharingcode language/linter/src/rules/style/branchessharingcode.rs:8