-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
Description
The suggestion to use resize()
is not optimal because it needs calculation of the difference between current size of the collection and the desired size. The suggestion to use vec![]
is not great because it will generally require an extra allocation. Instead, I've landed upon this solution. Maybe it could be suggested:
- for _ in 0..forward {
- self.buffer.push(255);
- }
+ self.buffer.extend(std::iter::repeat(255).take(forward));
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions