Panic when it is a logical error

This commit is contained in:
Quentin 2020-11-10 15:52:20 +01:00
parent d1b2fcc1e7
commit cacf8ddf2d

View file

@ -77,10 +77,7 @@ fn authority_to_host(authority: &str) -> Result<&str, Error> {
let split = match first_char {
'[' => {
let mut iter = iter.skip_while(|(_, c)| c != &']');
iter.next().ok_or(Error::BadRequest(format!(
"Authority {} has an illegal format",
authority
)))?;
iter.next().expect("Authority parsing logic error");
iter.next()
}
_ => iter.skip_while(|(_, c)| c != &':').next(),