Skip to content

Commit

Permalink
Use u32 index in test
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Sep 24, 2021
1 parent 72d96fa commit dfbf34b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 2 additions & 9 deletions polonius-engine/src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,9 @@ fn compare_errors<Loan: Atom, Point: Atom>(
mod tests {
use super::*;

impl Atom for usize {
fn index(self) -> usize {
self
}
}
type Idx = u32;

fn compare(
errors1: &FxHashMap<usize, Vec<usize>>,
errors2: &FxHashMap<usize, Vec<usize>>,
) -> bool {
fn compare(errors1: &FxHashMap<Idx, Vec<Idx>>, errors2: &FxHashMap<Idx, Vec<Idx>>) -> bool {
let diff1 = compare_errors(errors1, errors2);
let diff2 = compare_errors(errors2, errors1);
assert_eq!(diff1, diff2);
Expand Down
6 changes: 6 additions & 0 deletions polonius-facts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ pub trait Atom: From<u32> + Into<u32> + Copy + Clone + Debug + Eq + Ord + Hash +
fn index(self) -> usize;
}

impl Atom for u32 {
fn index(self) -> usize {
self as usize
}
}

pub trait FactTypes: Copy + Clone + Debug {
type Origin: Atom;
type Loan: Atom;
Expand Down

0 comments on commit dfbf34b

Please sign in to comment.