Simplify identifier parsing code

This commit is contained in:
Jonas Platte 2021-11-27 00:30:28 +01:00
parent 41fef1da64
commit bffddbd487
No known key found for this signature in database
GPG key ID: CC154DE0E30B7C67
15 changed files with 147 additions and 179 deletions

View file

@ -20,7 +20,6 @@ use {
},
ruma::api::{AuthScheme, IncomingRequest},
std::collections::BTreeMap,
std::convert::TryFrom,
std::io::Cursor,
tracing::{debug, warn},
};
@ -103,8 +102,7 @@ where
.unwrap()
},
|string| {
Box::<UserId>::try_from(string.expect("parsing to string always works"))
.unwrap()
UserId::parse(string.expect("parsing to string always works")).unwrap()
},
);
@ -171,7 +169,7 @@ where
}
};
let origin = match Box::<ServerName>::try_from(origin_str) {
let origin = match ServerName::parse(origin_str) {
Ok(s) => s,
_ => {
warn!(