Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
grim7reaper committed Nov 15, 2024
1 parent a9a93bd commit 31a2b31
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const SIZE: usize = 16;
pub struct Key([u8; SIZE]);

impl Key {
#[allow(clippy::cast_possible_truncation)] // len is in [0; 15].
#[expect(clippy::cast_possible_truncation, reason = "len is in [0; 15]")]
const fn len(self) -> u8 {
(15 - (u128::from_be_bytes(self.0).trailing_ones() / 8)) as u8
}
Expand All @@ -36,7 +36,10 @@ impl AsRef<[u8]> for Key {
}

impl From<Key> for CellIndex {
#[allow(clippy::cast_possible_truncation)] // resolution is in [0; 15].
#[expect(
clippy::cast_possible_truncation,
reason = "resolution is in [0; 15]"
)]
fn from(value: Key) -> Self {
let res = value.len();
let key = value.0;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
clippy::module_name_repetitions,
// Usually yes, but not really applicable for most literals in this crate.
clippy::unreadable_literal,
reason = "allow some exceptions"
)]

// }}}
Expand Down
8 changes: 5 additions & 3 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ impl<D: AsRef<[u8]>> FrozenMap<D> {
/// }
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
#[allow(clippy::missing_panics_doc)] // Expect don't need to be documented.
#[expect(
clippy::missing_panics_doc,
reason = "expect don't need to be documented"
)]
pub fn descendants(
&self,
index: CellIndex,
Expand Down Expand Up @@ -652,9 +655,8 @@ impl Iterator for FrozenMapValues<'_> {
type Item = u64;

fn next(&mut self) -> Option<Self::Item> {
self.values.next().map(|value| {
self.values.next().inspect(|_| {
self.count += 1;
value
})
}

Expand Down
5 changes: 4 additions & 1 deletion src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ impl<D: AsRef<[u8]>> FrozenSet<D> {
/// }
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
#[allow(clippy::missing_panics_doc)] // Expect don't need to be documented.
#[expect(
clippy::missing_panics_doc,
reason = "expect don't need to be documented"
)]
pub fn descendants(
&self,
index: CellIndex,
Expand Down

0 comments on commit 31a2b31

Please sign in to comment.