replace if / else with ok_or()
This commit is contained in:
parent
468e663344
commit
1c34ac38f7
@ -202,14 +202,7 @@ impl Blog {
|
|||||||
.load::<Blog>(&*c.conn)?
|
.load::<Blog>(&*c.conn)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.next();
|
.next();
|
||||||
if let Some(from_db) = from_db {
|
from_db.ok_or(Error::NotFound)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fetch_from_webfinger(c: &PlumeRocket, acct: &str) -> Result<Blog> {
|
fn fetch_from_webfinger(c: &PlumeRocket, acct: &str) -> Result<Blog> {
|
||||||
|
Loading…
Reference in New Issue
Block a user