Skip to content

Commit 632b090

Browse files
committed
cast keys as well as values for explicitly typed map macros
1 parent 8bc48dd commit 632b090

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/_std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! hash_map {
4646
#[macro_export]
4747
macro_rules! hash_map_e {
4848
{$($k: expr => $v: expr),* $(,)?} => {
49-
::std::collections::HashMap::from([$(($k, $v as _),)*])
49+
::std::collections::HashMap::from([$(($k as _, $v as _),)*])
5050
};
5151
}
5252

@@ -96,7 +96,7 @@ macro_rules! btree_map {
9696
#[macro_export]
9797
macro_rules! btree_map_e {
9898
{$($k: expr => $v: expr),* $(,)?} => {
99-
::std::collections::BTreeMap::from([$(($k, $v as _),)*])
99+
::std::collections::BTreeMap::from([$(($k as _, $v as _),)*])
100100
};
101101
}
102102

src/hashbrown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ macro_rules! __hb_hash_map {
7171
#[macro_export]
7272
macro_rules! __hb_hash_map_e {
7373
{$($k: expr => $v: expr),* $(,)?} => {
74-
<::hashbrown::HashMap::<_, _> as ::core::iter::FromIterator<_>>::from_iter([$(($k, $v as _),)*])
74+
<::hashbrown::HashMap::<_, _> as ::core::iter::FromIterator<_>>::from_iter([$(($k as _, $v as _),)*])
7575
};
7676
}
7777

0 commit comments

Comments
 (0)