prefer-map-entry Prefer one map entry operation over a guarded insertion Checking a map before inserting a missing value performs the same key lookup twice. Instead, you SHOULD use getOrInsertWith to combine the lookup and conditional insertion. - Category: performance - Level: warning - Fix: suggestion - Scope: module Reported import { Map } from "destack:collections"; function ensureValue(values: Map, key: string): void { if (!values.has(key)) { values.set(key, 1); } } Accepted import { Map } from "destack:collections"; function ensureValue(values: Map, key: string): void { values.getOrInsertWith(key, () => 1); } Prior art - Clippy ยท mapentry language/linter/src/rules/performance/prefermapentry.rs:8