summaryrefslogtreecommitdiffstats
path: root/src/http/routes/mutations.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
committeraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
commit3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (patch)
tree7cc7169181b4bdd73fd8817f8c1d7cce6e6998a8 /src/http/routes/mutations.rs
parent9dc9087d89891c6e5ef7e5dc084dd13c8611843e (diff)
downloadaur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.tar.gz
aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.zip
rustfmt,lints: pin the formatting, adopt the idiom lints, pay them off
rustfmt.toml fixes the shape the tree is written in (120 columns, small items kept on one line) and one canonical pass makes it the truth. [lints.clippy] names the idiom lints worth enforcing and leaves out the two that would add doc-comment boilerplate rather than remove it. The tree pays them off here: write!/writeln! instead of push_str(&format!()), let-else instead of match-on-Option, borrows where a thread entry point only reads what it owns, no `&self` on a Copy state and no `self` nobody reads. ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and value are now emitted by the same call instead of three.
Diffstat (limited to 'src/http/routes/mutations.rs')
-rw-r--r--src/http/routes/mutations.rs27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/http/routes/mutations.rs b/src/http/routes/mutations.rs
index ad11dfa..0d3b188 100644
--- a/src/http/routes/mutations.rs
+++ b/src/http/routes/mutations.rs
@@ -2,7 +2,10 @@ use crate::http::{Req, Res, State};
use crate::review::candidates;
use crate::usecase;
-use super::*;
+use super::{
+ actor, builds_with, chrome, flash_sub, not_found, page_to_res, panels_base, review_body, review_rows, short,
+ Packages, ReviewDetail, ReviewsPage,
+};
// -------------------------------------------------------------- approve --
@@ -102,21 +105,9 @@ pub(crate) fn review_reject(state: &State, req: &Req, id: &str) -> Res {
pub(crate) fn reviews_bulk(state: &State, req: &Req) -> Res {
let db = &state.db;
let form = req.form();
- let ids: Vec<i64> = form
- .iter()
- .filter(|(k, _)| k == "ids")
- .filter_map(|(_, v)| v.parse().ok())
- .collect();
- let decision = form
- .iter()
- .find(|(k, _)| k == "decision")
- .map(|(_, v)| v.clone())
- .unwrap_or_default();
- let confirmed: Vec<i64> = form
- .iter()
- .filter(|(k, _)| k == "confirm")
- .filter_map(|(_, v)| v.parse().ok())
- .collect();
+ let ids: Vec<i64> = form.iter().filter(|(k, _)| k == "ids").filter_map(|(_, v)| v.parse().ok()).collect();
+ let decision = form.iter().find(|(k, _)| k == "decision").map_or_default(|(_, v)| v.clone());
+ let confirmed: Vec<i64> = form.iter().filter(|(k, _)| k == "confirm").filter_map(|(_, v)| v.parse().ok()).collect();
if ids.is_empty() {
let mut page = chrome(state, req, "Reviews", "nav_reviews");
page.flash = "nothing selected".into();
@@ -185,9 +176,7 @@ pub(crate) fn sub_pause(state: &State, req: &Req) -> Res {
Ok(usecase::Pause::NotApplicable(other)) => {
flash_sub(state, req, &format!("{name} is {other}: nothing to pause"), true)
}
- Ok(usecase::Pause::Unknown) | Err(_) => {
- flash_sub(state, req, &format!("no subscription for {name}"), true)
- }
+ Ok(usecase::Pause::Unknown) | Err(_) => flash_sub(state, req, &format!("no subscription for {name}"), true),
}
}