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

Added, documented and tested two methods and applied changes by cargo clippy and fmt #229

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
Recent Changes (arrayvec)
=========================

## 0.7.3

- Add `.maybe_uninit_tail_mut()` and unsafe `.into_inner_zeroed_tail()` to `ArrayVec` by @JohnScience
- Small code cleanup by @JohnScience

## 0.7.2

- Add `.as_mut_str()` to `ArrayString` by @clarfonthey
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "arrayvec"
version = "0.7.2"
version = "0.7.3"
authors = ["bluss"]
license = "MIT OR Apache-2.0"
edition = "2018"
Expand Down
21 changes: 13 additions & 8 deletions benches/arraystring.rs
@@ -1,6 +1,6 @@

extern crate arrayvec;
#[macro_use] extern crate bencher;
#[macro_use]
extern crate bencher;

use arrayvec::ArrayString;

Expand All @@ -10,8 +10,7 @@ fn try_push_c(b: &mut Bencher) {
let mut v = ArrayString::<512>::new();
b.iter(|| {
v.clear();
while v.try_push('c').is_ok() {
}
while v.try_push('c').is_ok() {}
v.len()
});
b.bytes = v.capacity() as u64;
Expand All @@ -21,8 +20,7 @@ fn try_push_alpha(b: &mut Bencher) {
let mut v = ArrayString::<512>::new();
b.iter(|| {
v.clear();
while v.try_push('α').is_ok() {
}
while v.try_push('α').is_ok() {}
v.len()
});
b.bytes = v.capacity() as u64;
Expand Down Expand Up @@ -85,6 +83,13 @@ fn push_string(b: &mut Bencher) {
b.bytes = v.capacity() as u64;
}

benchmark_group!(benches, try_push_c, try_push_alpha, try_push_string, push_c,
push_alpha, push_string);
benchmark_group!(
benches,
try_push_c,
try_push_alpha,
try_push_string,
push_c,
push_alpha,
push_string
);
benchmark_main!(benches);
19 changes: 10 additions & 9 deletions benches/extend.rs
@@ -1,13 +1,13 @@

extern crate arrayvec;
#[macro_use] extern crate bencher;
#[macro_use]
extern crate bencher;

use std::io::Write;

use arrayvec::ArrayVec;

use bencher::Bencher;
use bencher::black_box;
use bencher::Bencher;

fn extend_with_constant(b: &mut Bencher) {
let mut v = ArrayVec::<u8, 512>::new();
Expand Down Expand Up @@ -67,12 +67,13 @@ fn extend_from_slice(b: &mut Bencher) {
b.bytes = v.capacity() as u64;
}

benchmark_group!(benches,
extend_with_constant,
extend_with_range,
extend_with_slice,
extend_with_write,
extend_from_slice
benchmark_group!(
benches,
extend_with_constant,
extend_with_range,
extend_with_slice,
extend_with_write,
extend_from_slice
);

benchmark_main!(benches);