Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
wainwrightmark committed Sep 20, 2024
1 parent 087ea0c commit 78d46a6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ insta = "1" # default features needed for testing
# Some useful libraries - uncomment if needed :-)
# tabled = "0.4.2"
# indoc = "1.0.4"
criterion = "0.4"
criterion = "0.5"
anyhow="1"
ntest= "0.9"
itertools="0.10"
itertools="0.13"
serde_test="1"
serde = {version = "1.0", features=["derive"]}
arbitrary = {version="1.3"}
arbtest = "0.2.0"
arbtest = "0.3"

[[bench]]
name = "my_benchmark"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# importunate

[<img alt="github" src="https://img.shields.io/badge/github-wainwrightmark/importunate-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="22">](https://github.com/wainwrightmark/importunate)
[<img alt="crates.io" src="https://img.shields.io/crates/v/importunate.svg?style=for-the-badge&color=fc8d62&logo=rust" height="22">](https://crates.io/crates/importunate)
[<img alt="docs.rs" src="https://img.shields.io/docsrs/importunate/latest?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" height="22">](https://docs.rs/importunate)
[<img alt="build status" src="https://img.shields.io/github/workflow/status/wainwrightmark/importunate/build/main?style=for-the-badge" height="22">](https://github.com/wainwrightmark/importunate/actions?query=branch%3Amain)
![GITHUB](https://img.shields.io/github/last-commit/wainwrightmark/importunate)
![Crates.io](https://img.shields.io/crates/v/importunate)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wainwrightmark/importunate/build.yml)
![docs](https://img.shields.io/docsrs/importunate)

Apply and manipulate permutations of small, const sized, distinct sets.

Expand Down
3 changes: 1 addition & 2 deletions src/cyclic_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ impl<I: Inner, const ELEMENTS: usize> Iterator for CyclicGenerator<I, ELEMENTS>
type Item = Permutation<I, ELEMENTS>;

fn next(&mut self) -> Option<Self::Item> {
let Some(n) = self.next
else {return None;};
let n = self.next?;

if n.is_default() {
self.next = None;
Expand Down
2 changes: 1 addition & 1 deletion src/decomposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<I: Inner, const ELEMENTS: usize> From<Permutation<I, ELEMENTS>> for Decompo
Self {
array: perm.get_array(),
index: 0,
phantom: core::marker::PhantomData::default(),
phantom: core::marker::PhantomData,
}
}
}
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
//! ```
//! use importunate::*;
//!
//! fn main() {
//! let arr1 = [2,0,1,3];
//! let mut arr2 = ["zero", "one", "two", "three"];
//! let perm = Permutation::<u8,4>::calculate_unchecked(arr1, |&x|x);
//! perm.apply(&mut arr2);
//!
//! assert_eq!(arr2,["two","zero", "one", "three"] );
//! }
//!
//!
//! ```
Expand Down Expand Up @@ -188,7 +186,7 @@ impl<I: Inner, const ELEMENTS: usize> Permutation<I, ELEMENTS> {
let mut mult: I = I::one();

for (i, swap) in swaps.enumerate() {
let r = mult * swap.try_into().ok().unwrap();
let r = mult * swap.into();
inner = inner + r;
mult = mult * (ELEMENTS - i).try_into().ok().unwrap();
}
Expand Down Expand Up @@ -509,7 +507,7 @@ impl<I: Inner, const ELEMENTS: usize> Permutation<I, ELEMENTS> {
let mut arr = [0u8; ELEMENTS];
let mut current = 0;
let mut pile_number = 0;
for element in arr.iter_mut() {
for element in &mut arr {
*element = current;
current += piles;
if current >= ELEMENTS as u8 {
Expand Down Expand Up @@ -563,7 +561,7 @@ impl<I: Inner, const ELEMENTS: usize> Permutation<I, ELEMENTS> {
mod tests {
use crate::Permutation;
use arbitrary::*;
use arbtest::arbitrary::{self, Unstructured};
use arbtest::{arbitrary::{self, Unstructured}, arbtest};

use itertools::Itertools;
use ntest::test_case;
Expand Down Expand Up @@ -674,7 +672,8 @@ mod tests {
assert_eq!(perm, perm2);
Ok(())
}
arbtest::builder().run(test_bytes1);

arbtest(|u|test_bytes1(u));
}

#[test]
Expand All @@ -690,7 +689,7 @@ mod tests {
Ok(())
}

arbtest::builder().run(test_inner1);
arbtest(|u|test_inner1(u));
}

#[test]
Expand All @@ -710,7 +709,7 @@ mod tests {
Ok(())
}

arbtest::builder().run(test_swaps1);
arbtest(|u|test_swaps1(u));
}

#[test]
Expand Down

0 comments on commit 78d46a6

Please sign in to comment.