Skip to content

ConcHashMap<K, V, H>::new() returns ConcHashMap<K, V, RandomState> instead of ConcHashMap<K, V, H> #8

@hniksic

Description

@hniksic

While experimenting with a non-default hasher and ConcHashMap, I found that the new method doesn't include the hasher in its type signature. As a result, code like the following:

type MyMap = ConcHashMap<(u64, u64), u8>;
...
let x: MyMap = MyMap::new();

doesn't compile because MyMap::new returns a type different than MyMap. This doesn't look intentional and is probably fixed simply by changing the return type of new from ConcHashMap<K, V> to ConcHashMap<K, V, H>.

An easy workaround is to import the Default trait and use MyMap::default() instead of MyMap::new().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions