From 1c34ac38f7362be79b447de0171453ef27fbc79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Mon, 27 May 2019 22:47:47 +0200 Subject: [PATCH] replace if / else with ok_or() --- plume-models/src/blogs.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index f2ea8235..f8fcffb3 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -202,14 +202,7 @@ impl Blog { .load::(&*c.conn)? .into_iter() .next(); - if let Some(from_db) = from_db { - Ok(from_db) - } else { - // we should never get here, because - // a) load::()? should return early if it fails - // b) this function is only called after a Request::guard::() - Err(Error::NotFound) - } + from_db.ok_or(Error::NotFound) } fn fetch_from_webfinger(c: &PlumeRocket, acct: &str) -> Result {