Skip to content

Commit eb69618

Browse files
committed
Fix some more Clippy lints
1 parent 57b1138 commit eb69618

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

examples/letter_counter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use plotlib::style::BoxStyle;
21
use std::collections::btree_map::BTreeMap;
32

43
fn main() {

src/text_render.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -488,41 +488,41 @@ mod tests {
488488
};
489489

490490
assert_eq!(
491-
run_bins_for_cells(&vec![-4, -1, 4, 7, 10]),
491+
run_bins_for_cells(&[-4, -1, 4, 7, 10]),
492492
[1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, n]
493493
);
494494
assert_eq!(
495-
run_bins_for_cells(&vec![0, 2, 4, 8, 10]),
495+
run_bins_for_cells(&[0, 2, 4, 8, 10]),
496496
[n, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, n]
497497
);
498498
assert_eq!(
499-
run_bins_for_cells(&vec![3, 5, 7, 9, 10]),
499+
run_bins_for_cells(&[3, 5, 7, 9, 10]),
500500
[n, n, n, n, 0, 0, 1, 1, 2, 2, 3, n]
501501
);
502502
assert_eq!(
503-
run_bins_for_cells(&vec![0, 2, 4, 6, 8]),
503+
run_bins_for_cells(&[0, 2, 4, 6, 8]),
504504
[n, 0, 0, 1, 1, 2, 2, 3, 3, n, n, n]
505505
);
506506
assert_eq!(
507-
run_bins_for_cells(&vec![0, 3, 6, 9, 12]),
507+
run_bins_for_cells(&[0, 3, 6, 9, 12]),
508508
[n, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3]
509509
);
510510

511511
assert_eq!(
512-
run_bins_for_cells(&vec![-5, -4, -3, -1, 0]),
512+
run_bins_for_cells(&[-5, -4, -3, -1, 0]),
513513
[3, n, n, n, n, n, n, n, n, n, n, n]
514514
);
515515
assert_eq!(
516-
run_bins_for_cells(&vec![10, 12, 14, 16, 18]),
516+
run_bins_for_cells(&[10, 12, 14, 16, 18]),
517517
[n, n, n, n, n, n, n, n, n, n, n, 0]
518518
);
519519

520520
assert_eq!(
521-
run_bins_for_cells(&vec![15, 16, 17, 18, 19]),
521+
run_bins_for_cells(&[15, 16, 17, 18, 19]),
522522
[n, n, n, n, n, n, n, n, n, n, n, n]
523523
);
524524
assert_eq!(
525-
run_bins_for_cells(&vec![-19, -18, -17, -16, -1]),
525+
run_bins_for_cells(&[-19, -18, -17, -16, -1]),
526526
[n, n, n, n, n, n, n, n, n, n, n, n]
527527
);
528528
}
@@ -542,31 +542,31 @@ mod tests {
542542
offset: 2,
543543
};
544544
assert_eq!(l.len(), 1);
545-
assert!(l.footprint() % 2 != 0);
545+
assert_ne!(l.footprint() % 2, 0);
546546
assert_eq!(l.start_offset(), 2);
547547

548548
let l = XAxisLabel {
549549
text: "34".to_string(),
550550
offset: 2,
551551
};
552552
assert_eq!(l.len(), 2);
553-
assert!(l.footprint() % 2 != 0);
553+
assert_ne!(l.footprint() % 2, 0);
554554
assert_eq!(l.start_offset(), 1);
555555

556556
let l = XAxisLabel {
557557
text: "345".to_string(),
558558
offset: 2,
559559
};
560560
assert_eq!(l.len(), 3);
561-
assert!(l.footprint() % 2 != 0);
561+
assert_ne!(l.footprint() % 2, 0);
562562
assert_eq!(l.start_offset(), 1);
563563

564564
let l = XAxisLabel {
565565
text: "3454".to_string(),
566566
offset: 1,
567567
};
568568
assert_eq!(l.len(), 4);
569-
assert!(l.footprint() % 2 != 0);
569+
assert_ne!(l.footprint() % 2, 0);
570570
assert_eq!(l.start_offset(), -1);
571571
}
572572

src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,20 @@ mod tests {
6969
#[test]
7070
fn test_pairwise() {
7171
let a = [1, 2, 3, 4, 5];
72-
assert_eq!(a.pairwise().nth(0).unwrap(), (&1, &2));
72+
assert_eq!(a.pairwise().next().unwrap(), (&1, &2));
7373
assert_eq!(a.pairwise().last().unwrap(), (&4, &5));
7474
assert_eq!(a.pairwise().len(), a.len() - 1);
7575

7676
let a = [1, 2];
77-
assert_eq!(a.pairwise().nth(0).unwrap(), (&1, &2));
77+
assert_eq!(a.pairwise().next().unwrap(), (&1, &2));
7878
assert_eq!(a.pairwise().last().unwrap(), (&1, &2));
7979
assert_eq!(a.pairwise().len(), a.len() - 1);
8080

8181
let a = [1];
82-
assert!(a.pairwise().nth(0).is_none());
82+
assert!(a.pairwise().next().is_none());
8383

8484
let b: Vec<f64> = vec![0.0, 0.1, 0.2];
85-
assert_eq!(b.pairwise().nth(0).unwrap(), (&0.0, &0.1));
85+
assert_eq!(b.pairwise().next().unwrap(), (&0.0, &0.1));
8686
}
8787

8888
#[test]

0 commit comments

Comments
 (0)