replace if / else with ok_or()

This commit is contained in:
Igor Galić 2019-05-27 22:47:47 +02:00 committed by Igor Galić
parent 468e663344
commit 1c34ac38f7
Signed by untrusted user: igalic
GPG key ID: ACFEFF7F6A123A86

View file

@ -202,14 +202,7 @@ impl Blog {
.load::<Blog>(&*c.conn)?
.into_iter()
.next();
if let Some(from_db) = from_db {
Ok(from_db)
} else {
// we should never get here, because
// a) load::<Blog>()? should return early if it fails
// b) this function is only called after a Request::guard::<Host>()
Err(Error::NotFound)
}
from_db.ok_or(Error::NotFound)
}
fn fetch_from_webfinger(c: &PlumeRocket, acct: &str) -> Result<Blog> {