Run cargo fmt

This commit is contained in:
Kitaiti Makoto 2021-01-16 01:13:45 +09:00
parent 3fd89e6b48
commit 26ffde726f
9 changed files with 55 additions and 32 deletions

View File

@ -314,8 +314,7 @@ fn get_proxy_config() -> Option<ProxyConfig> {
}
})
} else {
reqwest::Proxy::all(proxy_url)
.expect("Invalid PROXY_URL")
reqwest::Proxy::all(proxy_url).expect("Invalid PROXY_URL")
};
Some(ProxyConfig {
url,

View File

@ -287,15 +287,15 @@ impl Post {
pub fn get_receivers_urls(&self, conn: &Connection) -> Result<Vec<String>> {
Ok(self
.get_authors(conn)?
.into_iter()
.filter_map(|a| a.get_followers(conn).ok())
.fold(vec![], |mut acc, f| {
for x in f {
acc.push(x.ap_url);
}
acc
}))
.get_authors(conn)?
.into_iter()
.filter_map(|a| a.get_followers(conn).ok())
.fold(vec![], |mut acc, f| {
for x in f {
acc.push(x.ap_url);
}
acc
}))
}
pub fn to_activity(&self, conn: &Connection) -> Result<LicensedArticle> {

View File

@ -91,9 +91,11 @@ pub fn create(
});
Flash::success(
Redirect::to(
uri!(super::posts::details: blog = blog_name, slug = slug, responding_to = _),
),
Redirect::to(uri!(
super::posts::details: blog = blog_name,
slug = slug,
responding_to = _
)),
i18n!(&rockets.intl.catalog, "Your comment has been posted."),
)
})
@ -168,7 +170,11 @@ pub fn delete(
}
}
Ok(Flash::success(
Redirect::to(uri!(super::posts::details: blog = blog, slug = slug, responding_to = _)),
Redirect::to(uri!(
super::posts::details: blog = blog,
slug = slug,
responding_to = _
)),
i18n!(&rockets.intl.catalog, "Your comment has been deleted."),
))
}

View File

@ -408,9 +408,14 @@ pub fn interact(rockets: PlumeRocket, user: Option<User>, target: String) -> Opt
}
if let Ok(post) = Post::from_id(&rockets, &target, None, CONFIG.proxy()) {
return Some(Redirect::to(
uri!(super::posts::details: blog = post.get_blog(&rockets.conn).expect("Can't retrieve blog").fqn, slug = &post.slug, responding_to = _),
));
return Some(Redirect::to(uri!(
super::posts::details: blog = post
.get_blog(&rockets.conn)
.expect("Can't retrieve blog")
.fqn,
slug = &post.slug,
responding_to = _
)));
}
if let Ok(comment) = Comment::from_id(&rockets, &target, None, CONFIG.proxy()) {

View File

@ -45,9 +45,11 @@ pub fn create(
.execute(move || broadcast(&user, delete_act, dest, CONFIG.proxy().cloned()));
}
Ok(Redirect::to(
uri!(super::posts::details: blog = blog, slug = slug, responding_to = _),
))
Ok(Redirect::to(uri!(
super::posts::details: blog = blog,
slug = slug,
responding_to = _
)))
}
#[post("/~/<blog>/<slug>/like", rank = 2)]

View File

@ -356,7 +356,11 @@ pub fn update(
}
Flash::success(
Redirect::to(uri!(details: blog = blog, slug = new_slug, responding_to = _)),
Redirect::to(uri!(
details: blog = blog,
slug = new_slug,
responding_to = _
)),
i18n!(intl, "Your article has been updated."),
)
.into()
@ -543,7 +547,11 @@ pub fn create(
}
Ok(Flash::success(
Redirect::to(uri!(details: blog = blog_name, slug = slug, responding_to = _)),
Redirect::to(uri!(
details: blog = blog_name,
slug = slug,
responding_to = _
)),
i18n!(&rockets.intl.catalog, "Your article has been saved."),
)
.into())
@ -583,7 +591,11 @@ pub fn delete(
.any(|a| a.id == user.id)
{
return Ok(Flash::error(
Redirect::to(uri!(details: blog = blog_name, slug = slug, responding_to = _)),
Redirect::to(uri!(
details: blog = blog_name,
slug = slug,
responding_to = _
)),
i18n!(intl.catalog, "You are not allowed to delete this article."),
));
}

View File

@ -45,9 +45,11 @@ pub fn create(
.execute(move || broadcast(&user, delete_act, dest, CONFIG.proxy().cloned()));
}
Ok(Redirect::to(
uri!(super::posts::details: blog = blog, slug = slug, responding_to = _),
))
Ok(Redirect::to(uri!(
super::posts::details: blog = blog,
slug = slug,
responding_to = _
)))
}
#[post("/~/<blog>/<slug>/reshare", rank = 1)]

View File

@ -55,8 +55,7 @@ pub fn search(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
let query = query.map(Form::into_inner).unwrap_or_default();
let page = query.page.unwrap_or_default();
let mut parsed_query =
Query::from_str(&query.q.as_deref().unwrap_or_default())
.unwrap_or_default();
Query::from_str(&query.q.as_deref().unwrap_or_default()).unwrap_or_default();
param_to_query!(query, parsed_query; normal: title, subtitle, content, tag,
instance, author, blog, lang, license;

View File

@ -210,9 +210,7 @@ pub fn password_reset(
.map_err(|err| password_reset_error_response(err, &rockets))?;
Ok(Flash::success(
Redirect::to(uri!(
new: m = _
)),
Redirect::to(uri!(new: m = _)),
i18n!(
rockets.intl.catalog,
"Your password was successfully reset."