Skip to content

Dev #7

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

Merged
merged 7 commits into from
May 20, 2025
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ jobs:
components: rustfmt
- run: cargo fmt --all -- --check

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo doc

clippy:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -100,6 +107,7 @@ jobs:
- format
- clippy
- coverage
- doc
steps:
- name: validate
run: |
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"ryanluker.vscode-coverage-gutters",
]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"coverage-gutters.coverageBaseDir": "**",
}
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/andreiavrammsd/static_vector.rs"
readme = "README.md"
license = "MIT"
keywords = ["vector"]
categories = ["data-structures"]
categories = ["data-structures", "no-std"]
publish = false

[profile.dev]
Expand All @@ -24,6 +24,10 @@ opt-level = "z"

[lints.rust]
unsafe_code = "allow"
elided_lifetimes_in_paths = "forbid"

[lints.clippy]
wildcard_imports = "forbid"

[dev-dependencies]
criterion = "0.6.0"
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ fmt:
lint:
cargo clippy --all-targets --all-features

coverage:
coverage-html:
cargo llvm-cov --html
open target/llvm-cov/html/index.html

# for VS Code Coverage Gutters
coverage-info:
cargo llvm-cov --all-features --workspace --lcov --output-path target/llvm-cov/lcov.info

bench:
cargo bench
xdg-open target/criterion/push\ and\ clear/report/index.html
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,20 @@ impl<T: Clone, const CAPACITY: usize> Vec<T, CAPACITY> {

/// Returns an iterator over immutable references to the elements in the vector.
#[inline(always)]
pub fn iter(&self) -> Iter<T> {
pub fn iter(&self) -> Iter<'_, T> {
Iter::new(&self.data, self.length)
}

/// Returns an iterator over mutable references to the elements in the vector.
#[inline(always)]
pub fn iter_mut(&mut self) -> IterMut<T> {
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
IterMut::new(&mut self.data, self.length)
}

fn drop(&mut self, from: usize, to: usize) {
for i in from..to {
unsafe {
self.data[i].as_mut_ptr().drop_in_place();
self.data[i].assume_init_drop();
}
}
}
Expand Down