Skip to content

Commit adf933c

Browse files
Use u32 index in test
1 parent 81624af commit adf933c

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
@@ -623,16 +623,9 @@ fn compare_errors<Loan: Atom, Point: Atom>(
623623
mod tests {
624624
use super::*;
625625

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

632-
fn compare(
633-
errors1: &FxHashMap<usize, Vec<usize>>,
634-
errors2: &FxHashMap<usize, Vec<usize>>,
635-
) -> bool {
628+
fn compare(errors1: &FxHashMap<Idx, Vec<Idx>>, errors2: &FxHashMap<Idx, Vec<Idx>>) -> bool {
636629
let diff1 = compare_errors(errors1, errors2);
637630
let diff2 = compare_errors(errors2, errors1);
638631
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)