Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't .reserve() without a need #171

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
- Replaced `lazy_static` with `once_cell` as `once_cell::sync::Lazy` is being standardized and `lazy_static` is not actively maintained anymore.
- Added `fuzzy-matcher` as an optional dependency for fuzzy filtering in Select and MultiSelect prompts [#176](https://github.com/mikaelmello/inquire/pull/176)

### Internals

- Removed some useless `Vec::reserve()` calls

## [0.6.2] - 2023-05-07

- Allow usage of ANSI escape codes in prompts. [#136](https://github.com/mikaelmello/inquire/pull/136). Thanks to [@JimLynchCodes](https://github.com/JimLynchCodes) for reporting on [#135](https://github.com/mikaelmello/inquire/issues/135).
Expand Down
6 changes: 0 additions & 6 deletions inquire/src/prompts/custom_type/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@ where
where
V: CustomTypeValidator<T> + 'static,
{
// Directly make space for at least 5 elements, so we won't to re-allocate too often when
// calling this function repeatedly.
if self.validators.capacity() == 0 {
self.validators.reserve(5);
}

self.validators.push(Box::new(validator));
self
}
Expand Down
6 changes: 0 additions & 6 deletions inquire/src/prompts/dateselect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,6 @@ impl<'a> DateSelect<'a> {
where
V: DateValidator + 'static,
{
// Directly make space for at least 5 elements, so we won't to re-allocate too often when
// calling this function repeatedly.
if self.validators.capacity() == 0 {
self.validators.reserve(5);
}

self.validators.push(Box::new(validator));
self
}
Expand Down
6 changes: 0 additions & 6 deletions inquire/src/prompts/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ impl<'a> Editor<'a> {
where
V: StringValidator + 'static,
{
// Directly make space for at least 5 elements, so we won't to re-allocate too often when
// calling this function repeatedly.
if self.validators.capacity() == 0 {
self.validators.reserve(5);
}

self.validators.push(Box::new(validator));
self
}
Expand Down
6 changes: 0 additions & 6 deletions inquire/src/prompts/password/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ impl<'a> Password<'a> {
where
V: StringValidator + 'static,
{
// Directly make space for at least 5 elements, so we won't to re-allocate too often when
// calling this function repeatedly.
if self.validators.capacity() == 0 {
self.validators.reserve(5);
}

self.validators.push(Box::new(validator));
self
}
Expand Down
6 changes: 0 additions & 6 deletions inquire/src/prompts/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ impl<'a> Text<'a> {
where
V: StringValidator + 'static,
{
// Directly make space for at least 5 elements, so we won't to re-allocate too often when
// calling this function repeatedly.
if self.validators.capacity() == 0 {
self.validators.reserve(5);
}

self.validators.push(Box::new(validator));
self
}
Expand Down