Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HashMap union behaviour changed in 15.1 #202

Open
franziskuskiefer opened this issue Jun 28, 2022 · 0 comments
Open

HashMap union behaviour changed in 15.1 #202

franziskuskiefer opened this issue Jun 28, 2022 · 0 comments

Comments

@franziskuskiefer
Copy link

With the change in #163 the behaviour of union changed and the documentation is wrong now. It's unfortunate that such a breaking change is done in a minor version.

The comment says

    /// Construct the union of two maps, keeping the values in the
    /// current map when keys exist in both maps.

This is not the case anymore when the first map is the shorter one.
Adapting the example from the function description, the following fails

let map1 = hashmap! {1 => 1};
let map2 = hashmap! {1 => 2, 2 => 3};
let expected = hashmap! {1 => 1, 2 => 3};
assert_eq!(expected, map1.union(map2)); // the result is actually {2: 3, 1: 2}

Is this change in behaviour intentional? If it is intentional, the documentation should be changed and the new behaviour should be made clear in the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant