Simplify the Display implementation.

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-30 21:44:02 +01:00
parent 90c4aec54f
commit 0288b937df

View file

@ -52,14 +52,7 @@ impl From<Jid> for String {
impl fmt::Display for Jid { impl fmt::Display for Jid {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
// TODO: may need escaping fmt.write_str(String::from(self.clone()).as_ref())?;
if let Some(ref node) = self.node {
write!(fmt, "{}@", node)?;
}
write!(fmt, "{}", self.domain)?;
if let Some(ref resource) = self.resource {
write!(fmt, "/{}", resource)?;
}
Ok(()) Ok(())
} }
} }