search_same in clippy_utils - Rust
Description: Returns a list of groups where elements in each group are equal according to `eq`

Skip to main content

## search_same

# Function search_same

Source

    pub fn search_same<T, Hash, Eq>(exprs: &[T], hash: Hash, eq: Eq) -> Vec<Vec<&T>>where
        Hash: FnMut(&T) -> u64,
        Eq: FnMut(&T, &T) -> bool,

Expand description

Returns a list of groups where elements in each group are equal according to `eq`

- Within each group the elements are sorted by the order they appear in `exprs`
- The groups themselves are sorted by their first element’s appearence in `exprs`

Given functions `eq` and `hash` such that `eq(a, b) == true` implies `hash(a) == hash(b)`