performanceownershipallocation

Clone-cascade

Sprinkling .clone() across the call site to silence the borrow checker.

Why this looks tempting

It compiles. Every red squiggle disappears the moment .clone() lands.

Why wrong

Each .clone() is an allocation and copy you didn't need. They hide ownership confusion rather than resolve it — the program slows and the model never clears up.

Fix

Read the borrow checker's complaint, restructure to share via reference, or use Cow<'_, T> so allocation happens only when modification does.

Canonical alternative

smart-pointers/cow-pattern