diff --git a/CHANGELOG.md b/CHANGELOG.md index 912e104..cff6b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `hashbrown::hash_set` macro +### Removed + +* `map` macro + +* `map_e` macro + +* `set` macro + ## [0.2.6] @@ -63,7 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -* enhanced performance of `vec_no_clone` macro when used with a +* Enhanced performance of `vec_no_clone` macro when used with a list of elements @@ -71,7 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -* better allocation performace for all collections +* Better allocation performace for all collections ## [0.2.2] diff --git a/src/_std.rs b/src/_std.rs index 75a6263..47ced38 100644 --- a/src/_std.rs +++ b/src/_std.rs @@ -22,16 +22,6 @@ macro_rules! hash_map { }; } -/// Deprecated. Use [`hash_map!`] instead. -/// -#[deprecated = "deprecated in favour of `hash_map!`. Will be removed in `map-macro v0.3.0`"] -#[macro_export] -macro_rules! map { - {$($k: expr => $v: expr),* $(,)?} => { - ::std::collections::HashMap::from([$(($k, $v),)*]) - }; -} - /// Explicitly typed equivalent of [`hash_map!`], suitable for /// [trait object values](crate#explicitly-typed-values-for-trait-objects). /// @@ -60,16 +50,6 @@ macro_rules! hash_map_e { }; } -/// Deprecated. Use [`hash_map_e!`] instead. -/// -#[deprecated = "deprecated in favour of `hash_map_e!`. Will be removed in `map-macro v0.3.0`"] -#[macro_export] -macro_rules! map_e { - {$($k: expr => $v: expr),* $(,)?} => { - ::std::collections::HashMap::from([$(($k, $v as _),)*]) - }; -} - /// Macro for creating a [`BTreeMap`](::std::collections::BTreeMap). /// /// Syntactic sugar for [`BTreeMap::from`](::std::collections::BTreeMap::from). @@ -141,16 +121,6 @@ macro_rules! hash_set { }; } -/// Deprecated. Use [`hash_set!`] instead. -/// -#[deprecated = "deprecated in favour of `hash_set!`. Will be removed in `map-macro v0.3.0`"] -#[macro_export] -macro_rules! set { - {$($v: expr),* $(,)?} => { - ::std::collections::HashSet::from([$($v,)*]) - }; -} - /// Macro for creating a [`BTreeSet`](::std::collections::BTreeSet). /// /// Syntactic sugar for [`BTreeSet::from`](::std::collections::BTreeSet::from). diff --git a/tests/map.rs b/tests/map.rs deleted file mode 100644 index f3eb4a2..0000000 --- a/tests/map.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![allow(deprecated)] - -use std::collections::HashMap; -use std::fmt::Debug; - -use map_macro::{map, map_e}; - -#[derive(Debug)] -struct Dyn1; - -#[derive(Debug)] -struct Dyn2; - -#[test] -fn map1() { - let m = map! { - "en" => "Hello", - "de" => "Hallo", - "fr" => "Bonjour", - "es" => "Hola", - }; - - assert_eq!(m["en"], "Hello"); - assert_eq!(m["de"], "Hallo"); - assert_eq!(m["fr"], "Bonjour"); - assert_eq!(m["es"], "Hola"); -} - -#[test] -fn map2() { - let m = map! { - 0 => "a", - 1 => "b", - 2 => "c", - }; - - assert_eq!(m[&0], "a"); - assert_eq!(m[&1], "b"); - assert_eq!(m[&2], "c"); -} - -#[test] -fn map_e1() { - drop::>(map_e! { - "en" => &"Hello", - "de" => &"Hallo", - "fr" => &"Bonjour", - "es" => &"Hola", - }); -} - -#[test] -fn map_e2() { - drop::>(map_e! { - "1" => &Dyn1, - "2" => &Dyn2, - }); -} diff --git a/tests/set.rs b/tests/set.rs deleted file mode 100644 index 4d8dc55..0000000 --- a/tests/set.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![allow(deprecated)] - -use map_macro::set; - -#[test] -fn set1() { - let s = set! { "a", "b", "c", "d" }; - - assert_eq!(s.len(), 4); - - assert!(s.contains("a")); - assert!(s.contains("b")); - assert!(s.contains("c")); - assert!(s.contains("d")); - - assert!(!s.contains("e")); -} - -#[test] -fn set2() { - let s = set! { 0, 1, 2, 3, 0 }; - - assert_eq!(s.len(), 4); - - assert!(s.contains(&0)); - assert!(s.contains(&1)); - assert!(s.contains(&2)); - assert!(s.contains(&3)); - - assert!(!s.contains(&4)); -}