Skip to content

Commit 644f9df

Browse files
Use u32 index in test
1 parent e6ac7ad commit 644f9df

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

polonius-engine/src/output/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,9 @@ fn compare_errors<Loan: Atom, Point: Atom>(
624624
mod tests {
625625
use super::*;
626626

627-
impl Atom for usize {
628-
fn index(self) -> usize {
629-
self
630-
}
631-
}
627+
type Idx = u32;
632628

633-
fn compare(
634-
errors1: &FxHashMap<usize, Vec<usize>>,
635-
errors2: &FxHashMap<usize, Vec<usize>>,
636-
) -> bool {
629+
fn compare(errors1: &FxHashMap<Idx, Vec<Idx>>, errors2: &FxHashMap<Idx, Vec<Idx>>) -> bool {
637630
let diff1 = compare_errors(errors1, errors2);
638631
let diff2 = compare_errors(errors2, errors1);
639632
assert_eq!(diff1, diff2);

polonius-facts/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ pub trait Atom: From<u32> + Into<u32> + Copy + Clone + Debug + Eq + Ord + Hash +
118118
fn index(self) -> usize;
119119
}
120120

121+
impl Atom for u32 {
122+
fn index(self) -> usize {
123+
self as usize
124+
}
125+
}
126+
121127
pub trait FactTypes: Copy + Clone + Debug {
122128
type Origin: Atom;
123129
type Loan: Atom;

0 commit comments

Comments
 (0)