style: Run cargo fmt
This commit is contained in:
parent
b09c540080
commit
fc23f987cd
1 changed files with 7 additions and 9 deletions
|
@ -912,28 +912,26 @@ mod tests {
|
||||||
assert_eq!(fulljid, FullJid::new("node@domain/resource").unwrap());
|
assert_eq!(fulljid, FullJid::new("node@domain/resource").unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct User<T> {
|
struct User<T> {
|
||||||
jid: T,
|
jid: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
impl<T> From<T> for User<T> {
|
impl<T> From<T> for User<T> {
|
||||||
fn from(jid: T) -> User<T> {
|
fn from(jid: T) -> User<T> {
|
||||||
User {
|
User { jid }
|
||||||
jid,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
const BARE_JSON_STR: &'static str = "{\"jid\":\"node@domain\"}";
|
const BARE_JSON_STR: &'static str = "{\"jid\":\"node@domain\"}";
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
const FULL_JSON_STR: &'static str = "{\"jid\":\"node@domain/resource\"}";
|
const FULL_JSON_STR: &'static str = "{\"jid\":\"node@domain/resource\"}";
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
fn jid_serialize() {
|
fn jid_serialize() {
|
||||||
let jid: User<Jid> = Jid::new("node@domain").unwrap().into();
|
let jid: User<Jid> = Jid::new("node@domain").unwrap().into();
|
||||||
assert_eq!(BARE_JSON_STR, serde_json::to_string(&jid).unwrap());
|
assert_eq!(BARE_JSON_STR, serde_json::to_string(&jid).unwrap());
|
||||||
|
@ -944,7 +942,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature="serde")]
|
#[cfg(feature = "serde")]
|
||||||
fn jid_deserialize() {
|
fn jid_deserialize() {
|
||||||
let jid = Jid::new("node@domain").unwrap();
|
let jid = Jid::new("node@domain").unwrap();
|
||||||
let deser_jid: User<Jid> = serde_json::from_str(BARE_JSON_STR).unwrap();
|
let deser_jid: User<Jid> = serde_json::from_str(BARE_JSON_STR).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue