Skip to content

Commit

Permalink
Minor code reordering.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lymia committed May 8, 2023
1 parent a2f0ea5 commit 81f3838
Show file tree
Hide file tree
Showing 8 changed files with 872 additions and 875 deletions.
4 changes: 4 additions & 0 deletions enumset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ serde = ["serde2", "enumset_derive/serde"]
alloc = []
std = ["alloc", "enumset_derive/proc-macro-crate"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
enumset_derive = { version = "0.7.0", path = "../enumset_derive" }
serde2 = { package = "serde", version = "1", default-features = false, optional = true }
Expand Down
1 change: 1 addition & 0 deletions enumset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![deny(missing_docs)]
// The safety requirement is "use the procedural derive".
#![allow(clippy::missing_safety_doc)]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! A library for defining enums that can be used in compact bit sets. It supports arbitrarily
//! large enums, and has very basic support for using them in constants.
Expand Down
13 changes: 4 additions & 9 deletions enumset/src/repr/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,7 @@ impl<const N: usize> ArrayIter<N> {
for i in 0..N {
new[i] = PrimitiveIter(array.0[i])
}
ArrayIter {
data: new,
done: false,
idx_f: 0,
idx_r: N - 1,
}
ArrayIter { data: new, done: false, idx_f: 0, idx_r: N - 1 }
}
}

Expand All @@ -301,7 +296,7 @@ impl<const N: usize> Iterator for ArrayIter<N> {
}
while self.idx_f <= self.idx_r {
if let Some(x) = self.data[self.idx_f].next() {
return Some(self.idx_f as u32 * 64 + x)
return Some(self.idx_f as u32 * 64 + x);
} else {
self.idx_f += 1;
}
Expand All @@ -326,10 +321,10 @@ impl<const N: usize> DoubleEndedIterator for ArrayIter<N> {
}
while self.idx_f <= self.idx_r {
if let Some(x) = self.data[self.idx_r].next_back() {
return Some(self.idx_r as u32 * 64 + x)
return Some(self.idx_r as u32 * 64 + x);
} else {
if self.idx_r == 0 {
break
break;
}
self.idx_r -= 1;
}
Expand Down
Loading

0 comments on commit 81f3838

Please sign in to comment.