jid: Replace std stuff with alloc/core stuff

This commit is contained in:
xmppftw xmppftw 2024-12-19 19:43:02 +01:00 committed by Emmanuel Gil Peyrot
commit 4ac792b4d4

View file

@ -902,8 +902,10 @@ impl From<BareJid> for Node {
mod tests { mod tests {
use super::*; use super::*;
use std::collections::{HashMap, HashSet}; use alloc::{
use std::vec::Vec; collections::{BTreeMap, BTreeSet},
vec::Vec,
};
macro_rules! assert_size ( macro_rules! assert_size (
($t:ty, $sz:expr) => ( ($t:ty, $sz:expr) => (
@ -1036,7 +1038,7 @@ mod tests {
#[test] #[test]
fn hash() { fn hash() {
let _map: HashMap<Jid, String> = HashMap::new(); let _map: BTreeMap<Jid, String> = BTreeMap::new();
} }
#[test] #[test]
@ -1218,7 +1220,7 @@ mod tests {
#[test] #[test]
fn lookup_jid_by_full_jid() { fn lookup_jid_by_full_jid() {
let mut map: HashSet<Jid> = HashSet::new(); let mut map: BTreeSet<Jid> = BTreeSet::new();
let jid1 = Jid::new("foo@bar").unwrap(); let jid1 = Jid::new("foo@bar").unwrap();
let jid2 = Jid::new("foo@bar/baz").unwrap(); let jid2 = Jid::new("foo@bar/baz").unwrap();
let jid3 = FullJid::new("foo@bar/baz").unwrap(); let jid3 = FullJid::new("foo@bar/baz").unwrap();
@ -1232,7 +1234,7 @@ mod tests {
#[test] #[test]
fn lookup_full_jid_by_jid() { fn lookup_full_jid_by_jid() {
let mut map: HashSet<FullJid> = HashSet::new(); let mut map: BTreeSet<FullJid> = BTreeSet::new();
let jid1 = FullJid::new("foo@bar/baz").unwrap(); let jid1 = FullJid::new("foo@bar/baz").unwrap();
let jid2 = FullJid::new("foo@bar/fnord").unwrap(); let jid2 = FullJid::new("foo@bar/fnord").unwrap();
let jid3 = Jid::new("foo@bar/fnord").unwrap(); let jid3 = Jid::new("foo@bar/fnord").unwrap();
@ -1246,7 +1248,7 @@ mod tests {
#[test] #[test]
fn lookup_bare_jid_by_jid() { fn lookup_bare_jid_by_jid() {
let mut map: HashSet<BareJid> = HashSet::new(); let mut map: BTreeSet<BareJid> = BTreeSet::new();
let jid1 = BareJid::new("foo@bar").unwrap(); let jid1 = BareJid::new("foo@bar").unwrap();
let jid2 = BareJid::new("foo@baz").unwrap(); let jid2 = BareJid::new("foo@baz").unwrap();
let jid3 = Jid::new("foo@baz").unwrap(); let jid3 = Jid::new("foo@baz").unwrap();