no-allocation-for-comparison Disallow allocating conversions performed only to compare Converting a borrowed string or path into owned storage solely for equality performs an allocation without changing the comparison. Instead, you SHOULD compare the borrowed and owned representations directly. - Category: performance - Level: warning - Fix: suggestion - Scope: module Reported import { StringSlice } from "destack:string"; function matches(value: &readonly StringSlice, expected: string): boolean { return value.toOwned() == expected; } Accepted import { StringSlice } from "destack:string"; function matches(value: &readonly StringSlice, expected: string): boolean { return value == expected; } Prior art - Clippy ยท cmpowned language/linter/src/rules/performance/noallocationforcomparison.rs:8