Skip to content

Commit dfbf34b

Browse files
Use u32 index in test
1 parent 72d96fa commit dfbf34b

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

polonius-engine/src/output/mod.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -618,16 +618,9 @@ fn compare_errors<Loan: Atom, Point: Atom>(
618618
mod tests {
619619
use super::*;
620620

621-
impl Atom for usize {
622-
fn index(self) -> usize {
623-
self
624-
}
625-
}
621+
type Idx = u32;
626622

627-
fn compare(
628-
errors1: &FxHashMap<usize, Vec<usize>>,
629-
errors2: &FxHashMap<usize, Vec<usize>>,
630-
) -> bool {
623+
fn compare(errors1: &FxHashMap<Idx, Vec<Idx>>, errors2: &FxHashMap<Idx, Vec<Idx>>) -> bool {
631624
let diff1 = compare_errors(errors1, errors2);
632625
let diff2 = compare_errors(errors2, errors1);
633626
assert_eq!(diff1, diff2);

polonius-facts/src/lib.rs

+6
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)