rustfmt pass after split-jids merge
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
c7132bee9b
commit
24aef813b3
1 changed files with 12 additions and 13 deletions
25
src/lib.rs
25
src/lib.rs
|
|
@ -56,7 +56,7 @@ impl FromStr for Jid {
|
||||||
None => Jid::Bare(BareJid {
|
None => Jid::Bare(BareJid {
|
||||||
node: ns,
|
node: ns,
|
||||||
domain: ds,
|
domain: ds,
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,11 +235,7 @@ fn _from_str(s: &str) -> Result<StringJid, JidParseError> {
|
||||||
} else if let ParserState::Resource = state {
|
} else if let ParserState::Resource = state {
|
||||||
return Err(JidParseError::EmptyResource);
|
return Err(JidParseError::EmptyResource);
|
||||||
}
|
}
|
||||||
Ok((
|
Ok((node, domain.ok_or(JidParseError::NoDomain)?, resource))
|
||||||
node,
|
|
||||||
domain.ok_or(JidParseError::NoDomain)?,
|
|
||||||
resource,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for FullJid {
|
impl FromStr for FullJid {
|
||||||
|
|
@ -280,7 +276,7 @@ impl FullJid {
|
||||||
FullJid {
|
FullJid {
|
||||||
node: Some(node.into()),
|
node: Some(node.into()),
|
||||||
domain: domain.into(),
|
domain: domain.into(),
|
||||||
resource: resource.into()
|
resource: resource.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -554,7 +550,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_parse_full_jids() {
|
fn can_parse_full_jids() {
|
||||||
assert_eq!(FullJid::from_str("a@b.c/d"), Ok(FullJid::new("a", "b.c", "d")));
|
assert_eq!(
|
||||||
|
FullJid::from_str("a@b.c/d"),
|
||||||
|
Ok(FullJid::new("a", "b.c", "d"))
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
FullJid::from_str("b.c/d"),
|
FullJid::from_str("b.c/d"),
|
||||||
Ok(FullJid {
|
Ok(FullJid {
|
||||||
|
|
@ -606,7 +605,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bare_to_full_jid() {
|
fn bare_to_full_jid() {
|
||||||
assert_eq!(BareJid::new("a", "b.c").with_resource("d"), FullJid::new("a", "b.c", "d"));
|
assert_eq!(
|
||||||
|
BareJid::new("a", "b.c").with_resource("d"),
|
||||||
|
FullJid::new("a", "b.c", "d")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -615,10 +617,7 @@ mod tests {
|
||||||
String::from(FullJid::new("a", "b", "c")),
|
String::from(FullJid::new("a", "b", "c")),
|
||||||
String::from("a@b/c")
|
String::from("a@b/c")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(String::from(BareJid::new("a", "b")), String::from("a@b"));
|
||||||
String::from(BareJid::new("a", "b")),
|
|
||||||
String::from("a@b")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue