rust-doctor · Performance
unnecessary-allocation
Flags `Vec::new()` or `String::new()` inside loops. Each iteration allocates a new buffer, which is expensive.
- Severity
- warning
- Confidence
- medium
- Analyzer
- syn-ast
- Default policy
- Enabled
Tags
Framework requirements
No framework requirement.
Limitations
- Syntactic analysis does not have rustc name resolution or inferred type information.
Remediation
Move the allocation outside the loop and use `.clear()` to reuse it.
Fix capability: guidance