Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Use HashMap::from for immediate-use hashmaps initialization #511

Closed
shekhirin opened this issue Oct 16, 2021 · 0 comments · Fixed by #524
Closed

Use HashMap::from for immediate-use hashmaps initialization #511

shekhirin opened this issue Oct 16, 2021 · 0 comments · Fixed by #524

Comments

@shekhirin
Copy link
Contributor

shekhirin commented Oct 16, 2021

Is your feature request related to a problem? Please describe.
Currently, to initialize a HashMap that's intended to be used immediately with some values, we do

let mut map = HashMap::new();
map.insert("guid", guid.as_ref());
let body = self.create_query("contract", "checkverifystatus", map);

Rust 1.56.0 introduces a new way to do so:

let body = self.create_query("contract", "checkverifystatus", HashMap::from([
    ("guid", guid.as_ref()),
]));

thanks to const generics. Release with that feature is planned to be on 2021-10-21.

Describe the solution you'd like
Replace existing hashmap initializations with proposed solution.

@shekhirin shekhirin changed the title Use HashMap::from for immediate-use hashmaps initialization Use HashMap::from for immediate-use hashmaps initialization Oct 16, 2021
meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this issue Mar 21, 2022
* add --to-unit

* trim if only decimal 0s are found

* lint

* add another relevant example

* fix doctest
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant