Skip to content

Commit

Permalink
chore: made clippy happy for all targets
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Nov 13, 2023
1 parent e0d9616 commit a20358a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Run clippy
run: cargo clippy --no-default-features --features ${{ matrix.feature }}
run: cargo clippy --no-default-features --features ${{ matrix.feature }} --all-targets

tests:
name: Tests
Expand Down
2 changes: 1 addition & 1 deletion src/catch/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ mod test {
fn fruits_missing_objects() {
let (map, attrs) = test_data();

let state = CatchPP::new(&map)
let state = CatchPP::new(map)
.attributes(attrs)
.fruits(N_FRUITS - 10)
.droplets(N_DROPLETS - 1)
Expand Down
5 changes: 3 additions & 2 deletions src/mania/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ mod tests {
///
/// Very slow but accurate.
/// Only slight optimizations have been applied so that it doesn't run unreasonably long.
#[allow(clippy::too_many_arguments)]
fn brute_force_best(
acc: f64,
n320: Option<usize>,
Expand Down Expand Up @@ -1225,7 +1226,7 @@ mod tests {
fn hitresults_n320_n_misses_best() {
let (map, attrs) = test_data();

let state = ManiaPP::new(&map)
let state = ManiaPP::new(map)
.attributes(attrs)
.n320(500)
.n_misses(2)
Expand All @@ -1248,7 +1249,7 @@ mod tests {
fn hitresults_n100_n50_n_misses_worst() {
let (map, attrs) = test_data();

let state = ManiaPP::new(&map)
let state = ManiaPP::new(map)
.attributes(attrs)
.n100(200)
.n50(50)
Expand Down
2 changes: 1 addition & 1 deletion src/util/limited_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mod test {
assert!(!queue.is_empty());
assert_eq!(queue.len(), 1);
assert_eq!(queue.last(), Some(&elem));
assert!(queue.iter().eq(vec![elem].iter()));
assert!(queue.iter().eq([elem].iter()));
assert_eq!(queue[0], elem);
}

Expand Down
18 changes: 9 additions & 9 deletions tests/gradual_catch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ fn empty_map() {
#[test]
fn iter_end_eq_regular() {
let map = test_map!(Catch);
let regular = CatchStars::new(&map).calculate();
let regular = CatchStars::new(map).calculate();

let iter_end = CatchGradualDifficulty::new(&map, 0)
let iter_end = CatchGradualDifficulty::new(map, 0)
.last()
.expect("empty iter");

Expand All @@ -33,7 +33,7 @@ fn iter_end_eq_regular() {
#[test]
fn correct_empty() {
let map = test_map!(Catch);
let mut gradual = CatchGradualPerformance::new(&map, 0);
let mut gradual = CatchGradualPerformance::new(map, 0);
let state = CatchScoreState::default();

let first_attrs = gradual.nth(state.clone(), usize::MAX);
Expand All @@ -47,8 +47,8 @@ fn next_and_next_n() {
let map = test_map!(Catch);
let state = CatchScoreState::default();

let mut gradual1 = CatchGradualPerformance::new(&map, 0);
let mut gradual2 = CatchGradualPerformance::new(&map, 0);
let mut gradual1 = CatchGradualPerformance::new(map, 0);
let mut gradual2 = CatchGradualPerformance::new(map, 0);

for _ in 0..20 {
let _ = gradual1.next(state.clone());
Expand Down Expand Up @@ -79,9 +79,9 @@ fn next_and_next_n() {
#[test]
fn gradual_end_eq_regular() {
let map = test_map!(Catch);
let regular = CatchPP::new(&map).calculate();
let regular = CatchPP::new(map).calculate();

let mut gradual = CatchGradualPerformance::new(&map, 0);
let mut gradual = CatchGradualPerformance::new(map, 0);

let state = CatchScoreState {
max_combo: 730,
Expand All @@ -102,8 +102,8 @@ fn gradual_eq_regular_passed() {
let map = test_map!(Catch);
let n = 100;

let regular = CatchPP::new(&map).passed_objects(n).calculate();
let mut gradual = CatchGradualPerformance::new(&map, 0);
let regular = CatchPP::new(map).passed_objects(n).calculate();
let mut gradual = CatchGradualPerformance::new(map, 0);

let state = CatchScoreState {
max_combo: 101,
Expand Down
10 changes: 4 additions & 6 deletions tests/gradual_mania.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ fn empty_map() {
#[test]
fn gradual_end_eq_regular() {
let map = test_map!(Mania);
let regular = ManiaPP::new(&map).calculate();

let mut gradual = ManiaGradualPerformance::new(&map, 0);
let regular = ManiaPP::new(map).calculate();

let state = ManiaScoreState {
n320: map.hit_objects.len(),
..Default::default()
};

let gradual_end = gradual.nth(state, usize::MAX).unwrap();
let gradual = ManiaGradualPerformance::new(map, 0).last(state).unwrap();

assert_eq!(regular, gradual_end);
assert_eq!(regular, gradual);
}

#[test]
Expand Down Expand Up @@ -73,7 +71,7 @@ fn gradual_complete_next() {

let next_gradual_owned = gradual_owned.next(state.clone()).unwrap();

let regular_calc = ManiaPP::new(&map)
let regular_calc = ManiaPP::new(map)
.mods(mods)
.passed_objects(i)
.state(state.clone());
Expand Down
6 changes: 3 additions & 3 deletions tests/gradual_osu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fn empty_map() {
#[test]
fn gradual_end_eq_regular() {
let map = test_map!(Osu);
let regular = OsuPP::new(&map).calculate();
let mut gradual = OsuGradualPerformance::new(&map, 0);
let regular = OsuPP::new(map).calculate();
let mut gradual = OsuGradualPerformance::new(map, 0);

let state = OsuScoreState {
max_combo: 909,
Expand Down Expand Up @@ -74,7 +74,7 @@ fn gradual_complete_next() {

let next_gradual_owned = gradual_owned.next(state.clone()).unwrap();

let mut regular_calc = OsuPP::new(&map)
let mut regular_calc = OsuPP::new(map)
.mods(mods)
.passed_objects(i)
.state(state.clone());
Expand Down
6 changes: 3 additions & 3 deletions tests/gradual_taiko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn empty_map() {
#[test]
fn gradual_end_eq_regular() {
let map = test_map!(Taiko);
let regular = TaikoPP::new(&map).calculate();
let mut gradual = TaikoGradualPerformance::new(&map, 0);
let regular = TaikoPP::new(map).calculate();
let mut gradual = TaikoGradualPerformance::new(map, 0);

let state = TaikoScoreState {
max_combo: 289,
Expand Down Expand Up @@ -74,7 +74,7 @@ fn gradual_complete_next() {

let next_gradual_owned = gradual_owned.next(state.clone()).unwrap();

let mut regular_calc = TaikoPP::new(&map)
let mut regular_calc = TaikoPP::new(map)
.mods(mods)
.passed_objects(i)
.state(state.clone());
Expand Down

0 comments on commit a20358a

Please sign in to comment.