diff --git a/Cargo.lock b/Cargo.lock index d18e15c..a7d8beb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2145,7 +2145,6 @@ dependencies = [ "forge-core", "forge-git", "forge-web-app", - "forge-web-base", "forge-web-pages", "form_urlencoded", "futures-util", @@ -2158,7 +2157,6 @@ dependencies = [ "serde", "serde_json", "sha2 0.11.1", - "tar", "tempfile", "time", "tokio", @@ -2169,7 +2167,6 @@ dependencies = [ "webauthn-authenticator-rs", "webauthn-rs", "webauthn-rs-proto", - "zip", ] [[package]] diff --git a/crates/forge-ci/src/config.rs b/crates/forge-ci/src/config.rs index f0497b0..c3186fc 100644 --- a/crates/forge-ci/src/config.rs +++ b/crates/forge-ci/src/config.rs @@ -1748,7 +1748,10 @@ artifacts = ["target/release/forge"] } let many = ["\"0 3 * * *\""; MAX_SCHEDULES + 1].join(", "); let text = format!("[on]\nschedule = [{many}]\n{}", job_toml("")); - assert!(matches!(err_of(&text), ConfigError::TooManySchedules { .. })); + assert!(matches!( + err_of(&text), + ConfigError::TooManySchedules { .. } + )); } #[test] diff --git a/crates/forge-ci/src/mask.rs b/crates/forge-ci/src/mask.rs index f03a497..8ee022d 100644 --- a/crates/forge-ci/src/mask.rs +++ b/crates/forge-ci/src/mask.rs @@ -128,7 +128,10 @@ mod tests { let secret = "hunter2-secret"; let encoded = STANDARD.encode(secret.as_bytes()); let m = masker(&[secret]); - assert_eq!(stream_all(&m, &[format!("leak: {encoded}").as_bytes()]), "leak: ***"); + assert_eq!( + stream_all(&m, &[format!("leak: {encoded}").as_bytes()]), + "leak: ***" + ); let other = masker(&["abcdefgh"]); let enc = STANDARD.encode("abcdefgh"); assert_eq!(stream_all(&other, &[enc.as_bytes()]), "***"); diff --git a/crates/forge-core/src/advisories.rs b/crates/forge-core/src/advisories.rs index a4ebd83..819dc77 100644 --- a/crates/forge-core/src/advisories.rs +++ b/crates/forge-core/src/advisories.rs @@ -260,11 +260,7 @@ fn range_affects(range: &Range, version: &semver::Version) -> bool { for event in &range.events { match event { Event::Introduced(raw) => { - open = Some(if raw == "0" { - None - } else { - parse_version(raw) - }); + open = Some(if raw == "0" { None } else { parse_version(raw) }); } Event::Fixed(raw) => { if let Some(start) = open.take() diff --git a/crates/forge-core/src/model.rs b/crates/forge-core/src/model.rs index 9de0420..12ec751 100644 --- a/crates/forge-core/src/model.rs +++ b/crates/forge-core/src/model.rs @@ -9,7 +9,9 @@ pub enum Visibility { Private, } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] +#[derive( + Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, +)] #[serde(rename_all = "lowercase")] pub enum Role { Read, diff --git a/crates/forge-core/src/protection.rs b/crates/forge-core/src/protection.rs index d1f3bd3..c14f91e 100644 --- a/crates/forge-core/src/protection.rs +++ b/crates/forge-core/src/protection.rs @@ -312,27 +312,42 @@ mod tests { #[test] fn effective_without_rules_protects_only_default() { let none: &[BranchRule] = &[]; - assert_eq!(effective(none, "main", "main"), RuleFlags::basic(false, false)); - assert_eq!(effective(none, "main", "feature"), RuleFlags::basic(true, true)); + assert_eq!( + effective(none, "main", "main"), + RuleFlags::basic(false, false) + ); + assert_eq!( + effective(none, "main", "feature"), + RuleFlags::basic(true, true) + ); } #[test] fn effective_literal_allows_force_push_on_main() { let rules = [rule("main", true, false, "1")]; - assert_eq!(effective(&rules, "main", "main"), RuleFlags::basic(true, false)); + assert_eq!( + effective(&rules, "main", "main"), + RuleFlags::basic(true, false) + ); } #[test] fn effective_literal_beats_glob() { let rules = [rule("*", false, false, "1"), rule("main", true, true, "2")]; - assert_eq!(effective(&rules, "main", "main"), RuleFlags::basic(true, true)); + assert_eq!( + effective(&rules, "main", "main"), + RuleFlags::basic(true, true) + ); } #[test] fn effective_longer_glob_wins() { // Both `*` and `rel*` match `release`; the longer `rel*` wins even though `*` is older. let rules = [rule("*", true, true, "0"), rule("rel*", false, false, "1")]; - assert_eq!(effective(&rules, "main", "release"), RuleFlags::basic(false, false)); + assert_eq!( + effective(&rules, "main", "release"), + RuleFlags::basic(false, false) + ); // `release/**` is longer than `release/*`, so it wins for nested names. let rules = [ rule("release/*", true, true, "1"), diff --git a/crates/forge-core/src/store/account_tokens.rs b/crates/forge-core/src/store/account_tokens.rs index 4666b5c..51f48cb 100644 --- a/crates/forge-core/src/store/account_tokens.rs +++ b/crates/forge-core/src/store/account_tokens.rs @@ -7,7 +7,7 @@ use std::time::Duration; use super::finish; use super::{ - USER_COLS, Store, col_int, col_opt_text, col_text, db_err, fetch_opt, insert_err, map_user, + Store, USER_COLS, col_int, col_opt_text, col_text, db_err, fetch_opt, insert_err, map_user, new_id, }; use crate::error::{Error, Result}; diff --git a/crates/forge-core/src/store/admin_alerts.rs b/crates/forge-core/src/store/admin_alerts.rs index 420f1ce..2b36f23 100644 --- a/crates/forge-core/src/store/admin_alerts.rs +++ b/crates/forge-core/src/store/admin_alerts.rs @@ -257,7 +257,9 @@ impl Store { let conn = self.read_conn().await; fetch_opt( &conn, - &format!("SELECT {NOTICE_COLS} FROM admin_notifications WHERE id = ?1 AND user_id = ?2"), + &format!( + "SELECT {NOTICE_COLS} FROM admin_notifications WHERE id = ?1 AND user_id = ?2" + ), (id.to_owned(), user_id.to_owned()), map_notice, ) diff --git a/crates/forge-core/src/store/ci.rs b/crates/forge-core/src/store/ci.rs index 2fda14c..84aa218 100644 --- a/crates/forge-core/src/store/ci.rs +++ b/crates/forge-core/src/store/ci.rs @@ -14,9 +14,9 @@ use super::{ fetch_opt, finish, insert_err, missing_row, new_id, opt_int_value, opt_text, text, }; use crate::ci::{ - CiArtifact, CiJob, CiRun, CiRunner, FieldKind, JobSample, JobState, JobStep, - MemoryOffer, NewJob, NewRun, QueueSkips, RestartMode, RunState, RunnerJob, RunnerReport, - RunnerRestart, STARVE_AFTER_SECS, StepSample, pick_by_memory, validate_runner_field, + CiArtifact, CiJob, CiRun, CiRunner, FieldKind, JobSample, JobState, JobStep, MemoryOffer, + NewJob, NewRun, QueueSkips, RestartMode, RunState, RunnerJob, RunnerReport, RunnerRestart, + STARVE_AFTER_SECS, StepSample, pick_by_memory, validate_runner_field, }; use crate::error::{Error, Result}; use crate::secret; diff --git a/crates/forge-core/src/store/health.rs b/crates/forge-core/src/store/health.rs index 70747a0..e97ab28 100644 --- a/crates/forge-core/src/store/health.rs +++ b/crates/forge-core/src/store/health.rs @@ -30,7 +30,9 @@ impl Store { /// Counts of repos, users, queued CI jobs and runners. Five indexed `COUNT(*)` queries. pub async fn health_counts(&self) -> Result { let conn = self.read_conn().await; - let since = stamp_ago(std::time::Duration::from_secs(RUNNER_ONLINE_SECS.unsigned_abs())); + let since = stamp_ago(std::time::Duration::from_secs( + RUNNER_ONLINE_SECS.unsigned_abs(), + )); let plain = |sql: &'static str| { let conn = &conn; async move { diff --git a/crates/forge-core/src/store/issues.rs b/crates/forge-core/src/store/issues.rs index 045216c..c97ce3b 100644 --- a/crates/forge-core/src/store/issues.rs +++ b/crates/forge-core/src/store/issues.rs @@ -361,7 +361,9 @@ impl Store { clauses.push("i.title LIKE ? ESCAPE '\\'"); params.push(Value::Text(like_pattern(query))); } - if kind == "pull" && let Some(draft) = f.draft { + if kind == "pull" + && let Some(draft) = f.draft + { clauses.push(if draft { "EXISTS (SELECT 1 FROM pull_requests pr WHERE pr.issue_id = i.id AND pr.draft = 1)" } else { diff --git a/crates/forge-core/src/store/labels.rs b/crates/forge-core/src/store/labels.rs index 68e2362..74658cd 100644 --- a/crates/forge-core/src/store/labels.rs +++ b/crates/forge-core/src/store/labels.rs @@ -715,9 +715,9 @@ async fn issue_repo_id(conn: &Connection, issue_id: &str) -> Result { #[cfg(test)] mod tests { use super::*; - use serde_json::Value; use crate::issues::{IssueEvent, StateReason}; use crate::model::{Role, Visibility}; + use serde_json::Value; struct Fixture { _dir: tempfile::TempDir, diff --git a/crates/forge-core/src/store/mod.rs b/crates/forge-core/src/store/mod.rs index d49bf35..ebb5444 100644 --- a/crates/forge-core/src/store/mod.rs +++ b/crates/forge-core/src/store/mod.rs @@ -158,8 +158,12 @@ impl Store { for _ in 0..READER_COUNT { let reader = db.connect().map_err(db_err)?; apply_pragmas(&reader).await; - run_pragma(&reader, "PRAGMA query_only = 1").await.map_err(db_err)?; - run_pragma(&reader, "PRAGMA cache_size = -2048").await.map_err(db_err)?; + run_pragma(&reader, "PRAGMA query_only = 1") + .await + .map_err(db_err)?; + run_pragma(&reader, "PRAGMA cache_size = -2048") + .await + .map_err(db_err)?; readers.push(Mutex::new(reader)); } Ok(Store { @@ -754,7 +758,9 @@ impl Store { return Ok((None, None)); }; let collaborator = self.collaborator_role(&repo.id, &user.id).await?; - let org = self.org_repo_role(&repo.owner_id, &user.id, &repo.id).await?; + let org = self + .org_repo_role(&repo.owner_id, &user.id, &repo.id) + .await?; Ok((collaborator, org)) } diff --git a/crates/forge-core/src/store/notifications.rs b/crates/forge-core/src/store/notifications.rs index 4521205..2df3e51 100644 --- a/crates/forge-core/src/store/notifications.rs +++ b/crates/forge-core/src/store/notifications.rs @@ -4,7 +4,9 @@ use turso::transaction::Transaction; use turso::{Row, Value}; use super::repo_listing::VIEWER_ACCESS; -use super::{Store, USER_COLS, col_int, col_text, db_err, fetch_all, fetch_opt, finish, map_user, new_id}; +use super::{ + Store, USER_COLS, col_int, col_text, db_err, fetch_all, fetch_opt, finish, map_user, new_id, +}; use crate::error::{Error, Result}; use crate::model::{Id, User}; use crate::notifications::{Notification, Reason, SubState, WatchLevel}; @@ -642,8 +644,26 @@ mod tests { let s = &fx.store; let ivy = user(s, "Ivy").await; - notify(s, &ivy, &fx.repo, &fx.issue_a, Reason::Mention, "mentioned", Some(&fx.bob)).await; - notify(s, &ivy, &fx.repo, &fx.issue_a, Reason::Comment, "comment", Some(&fx.bob)).await; + notify( + s, + &ivy, + &fx.repo, + &fx.issue_a, + Reason::Mention, + "mentioned", + Some(&fx.bob), + ) + .await; + notify( + s, + &ivy, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; assert_eq!( reason_of(s, &ivy, &fx.issue_a).await, Reason::Mention, @@ -652,16 +672,42 @@ mod tests { assert_eq!(s.unread_count(&ivy).await.unwrap(), 1, "upsert: one unread"); s.mark_issue_read(&ivy, &fx.issue_a).await.unwrap(); - assert_eq!(s.unread_count(&ivy).await.unwrap(), 0, "upsert: marked read"); - notify(s, &ivy, &fx.repo, &fx.issue_a, Reason::Comment, "comment", Some(&fx.bob)).await; + assert_eq!( + s.unread_count(&ivy).await.unwrap(), + 0, + "upsert: marked read" + ); + notify( + s, + &ivy, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; assert_eq!( reason_of(s, &ivy, &fx.issue_a).await, Reason::Comment, "upsert: read row replaced" ); - assert_eq!(s.unread_count(&ivy).await.unwrap(), 1, "upsert: unread again"); + assert_eq!( + s.unread_count(&ivy).await.unwrap(), + 1, + "upsert: unread again" + ); - notify(s, &ivy, &fx.repo, &fx.issue_a, Reason::Assign, "assigned", None).await; + notify( + s, + &ivy, + &fx.repo, + &fx.issue_a, + Reason::Assign, + "assigned", + None, + ) + .await; let inbox = s.list_notifications(&ivy, false, None, 10).await.unwrap(); assert_eq!(inbox.len(), 1, "upsert: still one row"); assert_eq!( @@ -673,8 +719,26 @@ mod tests { assert_eq!(inbox[0].last_actor_name, None, "upsert: no actor given"); let kim = user(s, "Kim").await; - notify(s, &kim, &fx.repo, &fx.issue_a, Reason::Comment, "comment", Some(&fx.bob)).await; - notify(s, &kim, &fx.repo, &fx.issue_b, Reason::Comment, "comment", Some(&fx.bob)).await; + notify( + s, + &kim, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; + notify( + s, + &kim, + &fx.repo, + &fx.issue_b, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; s.mark_issue_read(&kim, &fx.issue_b).await.unwrap(); let all = s.list_notifications(&kim, false, None, 50).await.unwrap(); @@ -720,9 +784,36 @@ mod tests { let ned = user(s, "Ned").await; let olive = user(s, "Olive").await; - notify(s, &ned, &fx.repo, &fx.issue_a, Reason::Comment, "comment", None).await; - notify(s, &ned, &fx.repo, &fx.issue_b, Reason::Comment, "comment", None).await; - notify(s, &olive, &fx.repo, &fx.issue_a, Reason::Comment, "comment", None).await; + notify( + s, + &ned, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + None, + ) + .await; + notify( + s, + &ned, + &fx.repo, + &fx.issue_b, + Reason::Comment, + "comment", + None, + ) + .await; + notify( + s, + &olive, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + None, + ) + .await; assert_eq!(s.unread_count(&ned).await.unwrap(), 2, "read: two unread"); let inbox = s.list_notifications(&ned, false, None, 50).await.unwrap(); @@ -738,7 +829,16 @@ mod tests { s.mark_read(&ned, &inbox[1].id).await.unwrap(); assert_eq!(s.unread_count(&ned).await.unwrap(), 0, "read: second by id"); - notify(s, &ned, &fx.repo, &fx.issue_a, Reason::Comment, "comment", None).await; + notify( + s, + &ned, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + None, + ) + .await; s.mark_all_read(&ned, Some(&fx.repo)).await.unwrap(); assert_eq!(s.unread_count(&ned).await.unwrap(), 0, "read: all in repo"); assert_eq!( @@ -747,7 +847,16 @@ mod tests { "read: other user kept" ); - notify(s, &ned, &fx.repo, &fx.issue_b, Reason::Comment, "comment", None).await; + notify( + s, + &ned, + &fx.repo, + &fx.issue_b, + Reason::Comment, + "comment", + None, + ) + .await; s.mark_all_read(&ned, None).await.unwrap(); assert_eq!(s.unread_count(&ned).await.unwrap(), 0, "read: all, no repo"); s.mark_all_read(&olive, Some("no-such-repo")).await.unwrap(); @@ -758,8 +867,26 @@ mod tests { ); let max = user(s, "Max").await; - notify(s, &max, &fx.repo, &fx.issue_a, Reason::Comment, "comment", None).await; - notify(s, &max, &fx.repo, &fx.issue_b, Reason::Comment, "comment", None).await; + notify( + s, + &max, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + None, + ) + .await; + notify( + s, + &max, + &fx.repo, + &fx.issue_b, + Reason::Comment, + "comment", + None, + ) + .await; s.mark_issue_read(&max, &fx.issue_a).await.unwrap(); assert_eq!( s.unread_count(&max).await.unwrap(), @@ -795,7 +922,16 @@ mod tests { s.subscribe(&pat, &doomed_issue, SubState::Subscribed, Reason::Author) .await .unwrap(); - notify(s, &pat, &doomed, &doomed_issue, Reason::Comment, "comment", Some(&fx.bob)).await; + notify( + s, + &pat, + &doomed, + &doomed_issue, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; s.delete_repo(&doomed).await.unwrap(); assert_eq!( @@ -843,8 +979,26 @@ mod tests { s.subscribe(&quin, &fx.issue_a, SubState::Subscribed, Reason::Author) .await .unwrap(); - notify(s, &ray, &fx.repo, &fx.issue_a, Reason::Comment, "comment", Some(&quin)).await; - notify(s, &quin, &fx.repo, &fx.issue_b, Reason::Comment, "comment", Some(&fx.bob)).await; + notify( + s, + &ray, + &fx.repo, + &fx.issue_a, + Reason::Comment, + "comment", + Some(&quin), + ) + .await; + notify( + s, + &quin, + &fx.repo, + &fx.issue_b, + Reason::Comment, + "comment", + Some(&fx.bob), + ) + .await; s.delete_user(&quin, &ghost.id).await.unwrap(); diff --git a/crates/forge-core/src/store/pulls.rs b/crates/forge-core/src/store/pulls.rs index 02c2acb..5e41fd6 100644 --- a/crates/forge-core/src/store/pulls.rs +++ b/crates/forge-core/src/store/pulls.rs @@ -3,9 +3,8 @@ use turso::{Connection, Row}; use super::issues::{insert_event, map_issue, parse_db}; use super::{ - finish, - REPO_COLS, Store, col_int, col_opt_text, col_text, db_err, fetch_all, fetch_opt, insert_err, - map_repo, new_id, + REPO_COLS, Store, col_int, col_opt_text, col_text, db_err, fetch_all, fetch_opt, finish, + insert_err, map_repo, new_id, }; use crate::error::{Error, Result}; use crate::issues::{IssueFilter, IssueListItem, IssueState, validate_body, validate_title}; diff --git a/crates/forge-core/src/store/pulls_list_extra.rs b/crates/forge-core/src/store/pulls_list_extra.rs index 0f805b1..88b90ac 100644 --- a/crates/forge-core/src/store/pulls_list_extra.rs +++ b/crates/forge-core/src/store/pulls_list_extra.rs @@ -10,13 +10,15 @@ use crate::error::Result; impl Store { /// Which of `numbers` are draft pull requests of this repo. pub async fn draft_numbers(&self, repo_id: &str, numbers: &[i64]) -> Result> { - self.pull_numbers_where(repo_id, numbers, "p.draft = 1").await + self.pull_numbers_where(repo_id, numbers, "p.draft = 1") + .await } /// Which of `numbers` are merged pull requests of this repo. Numbers that are issues, open /// or closed without a merge are left out. pub async fn merged_numbers(&self, repo_id: &str, numbers: &[i64]) -> Result> { - self.pull_numbers_where(repo_id, numbers, "p.merged_at IS NOT NULL").await + self.pull_numbers_where(repo_id, numbers, "p.merged_at IS NOT NULL") + .await } async fn pull_numbers_where( diff --git a/crates/forge-core/src/store/reviews.rs b/crates/forge-core/src/store/reviews.rs index 12012dd..281af0a 100644 --- a/crates/forge-core/src/store/reviews.rs +++ b/crates/forge-core/src/store/reviews.rs @@ -10,9 +10,8 @@ use turso::{Connection, Row}; use super::issues::{insert_event, parse_db}; use super::{ - finish, - Store, col_bool, col_int, col_opt_text, col_text, db_err, fetch_all, fetch_opt, missing_row, - new_id, + Store, col_bool, col_int, col_opt_text, col_text, db_err, fetch_all, fetch_opt, finish, + missing_row, new_id, }; use crate::error::{Error, Result}; use crate::issues::validate_body; diff --git a/crates/forge-e2e/tests/e2e/issue_close_e2e.rs b/crates/forge-e2e/tests/e2e/issue_close_e2e.rs index bca14b3..fbba1a4 100644 --- a/crates/forge-e2e/tests/e2e/issue_close_e2e.rs +++ b/crates/forge-e2e/tests/e2e/issue_close_e2e.rs @@ -4,8 +4,7 @@ //! file, and every push is a real `git push` through the git HTTP endpoints. use crate::common::{ - Http, input_value, launch, login, pick_ports, relaunch, run_admin, tool_on_path, - write_config, + Http, input_value, launch, login, pick_ports, relaunch, run_admin, tool_on_path, write_config, }; use std::fs; use std::future::Future; diff --git a/crates/forge-e2e/tests/e2e/lfs_e2e.rs b/crates/forge-e2e/tests/e2e/lfs_e2e.rs index 6e259f7..1c54e1c 100644 --- a/crates/forge-e2e/tests/e2e/lfs_e2e.rs +++ b/crates/forge-e2e/tests/e2e/lfs_e2e.rs @@ -5,7 +5,9 @@ //! Git config is isolated from the developer's machine: `HOME` and `GIT_CONFIG_GLOBAL` point into //! the test's temp dir. -use crate::common::{Http, describe, input_value, launch, login, pick_ports, run_admin, write_config}; +use crate::common::{ + Http, describe, input_value, launch, login, pick_ports, run_admin, write_config, +}; use std::fs; use std::path::Path; use std::process::{Command, Output}; diff --git a/crates/forge-e2e/tests/e2e/oci_e2e.rs b/crates/forge-e2e/tests/e2e/oci_e2e.rs index bb022e1..ad6b037 100644 --- a/crates/forge-e2e/tests/e2e/oci_e2e.rs +++ b/crates/forge-e2e/tests/e2e/oci_e2e.rs @@ -365,10 +365,7 @@ async fn push_by_monolithic_and_chunked_upload_then_pull_by_tag_and_digest() { ); let res = push_blob_chunked(http, "tahinli/app", &auth, &layer_two).await; assert_eq!(res.status, 201, "{}", res.text()); - assert_eq!( - res.header("location"), - Some(blob_path(&layer_two).as_str()) - ); + assert_eq!(res.header("location"), Some(blob_path(&layer_two).as_str())); let head = http .send( @@ -381,12 +378,7 @@ async fn push_by_monolithic_and_chunked_upload_then_pull_by_tag_and_digest() { .await; assert_eq!(head.status, 200); assert_eq!(head.header("content-length"), Some("3000")); - let blob = http - .get( - &blob_path(&layer_two), - Some(&auth), - ) - .await; + let blob = http.get(&blob_path(&layer_two), Some(&auth)).await; assert_eq!(blob.status, 200); assert_eq!(blob.body, layer_two); @@ -505,12 +497,7 @@ async fn bad_digests_and_missing_blobs_are_refused_with_oci_codes() { assert_eq!(res.status, 400); assert_eq!(res.error_code(), "NAME_INVALID"); - let res = http - .get( - &blob_path(b"absent"), - Some(&auth), - ) - .await; + let res = http.get(&blob_path(b"absent"), Some(&auth)).await; assert_eq!(res.status, 404); assert_eq!(res.error_code(), "BLOB_UNKNOWN"); } @@ -604,12 +591,7 @@ async fn a_public_image_pulls_anonymously_and_a_private_one_does_not() { let anon = http.get("/v2/tahinli/app/manifests/v1", None).await; assert_eq!(anon.status, 200, "{}", anon.text()); assert_eq!(anon.body, image); - let anon_blob = http - .get( - &blob_path(&config), - None, - ) - .await; + let anon_blob = http.get(&blob_path(&config), None).await; assert_eq!(anon_blob.status, 200); let hidden = http.get("/v2/tahinli/secret/manifests/v1", None).await; @@ -781,8 +763,14 @@ async fn deleting_tags_and_manifests_keeps_fresh_blobs_for_the_grace_period() { ); // The blobs were pushed just now: the sweep keeps a link newer than the grace period, since a // push can still be on its way to a manifest. The store test covers the sweep after it. - assert_eq!(http.get(&blob_path(&layer_b), Some(&auth)).await.status, 200); - assert_eq!(http.get(&blob_path(&layer_a), Some(&auth)).await.status, 200); + assert_eq!( + http.get(&blob_path(&layer_b), Some(&auth)).await.status, + 200 + ); + assert_eq!( + http.get(&blob_path(&layer_a), Some(&auth)).await.status, + 200 + ); assert_eq!(http.get(&blob_path(&config), Some(&auth)).await.status, 200); let v1_digest = sha256_digest(&v1); @@ -796,7 +784,10 @@ async fn deleting_tags_and_manifests_keeps_fresh_blobs_for_the_grace_period() { ) .await; assert_eq!(res.status, 202); - assert_eq!(http.get(&blob_path(&layer_a), Some(&auth)).await.status, 200); + assert_eq!( + http.get(&blob_path(&layer_a), Some(&auth)).await.status, + 200 + ); assert_eq!(http.get(&blob_path(&config), Some(&auth)).await.status, 200); let tags = http.get("/v2/tahinli/app/tags/list", Some(&auth)).await; assert_eq!(tags.json()["tags"], serde_json::json!([])); diff --git a/crates/forge-e2e/tests/e2e/pulls_e2e.rs b/crates/forge-e2e/tests/e2e/pulls_e2e.rs index 43cb530..af62369 100644 --- a/crates/forge-e2e/tests/e2e/pulls_e2e.rs +++ b/crates/forge-e2e/tests/e2e/pulls_e2e.rs @@ -188,13 +188,7 @@ async fn tahinli_repo_with_main(b: &Booted) -> (String, String, PathBuf) { &remote(b.http_port, "tahinli", &token, "tahinli", "r"), &b.dir.join("tahinli-work"), ); - commit( - &work, - "base.txt", - "base\n", - "base commit", - TAHINLI, - ); + commit(&work, "base.txt", "base\n", "base commit", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/main"]); (tahinli, token, work) } @@ -294,13 +288,7 @@ async fn same_repo_pull_merges_and_closes_issue() { assert_eq!(issue, 1); git(&work, &["checkout", "-q", "-b", "feature"]); - let feature_head = commit( - &work, - "x.txt", - "x\n", - "Add x\n\nFixes #1", - TAHINLI, - ); + let feature_head = commit(&work, "x.txt", "x\n", "Add x\n\nFixes #1", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/feature"]); let compare = b @@ -360,23 +348,11 @@ async fn push_to_head_branch_updates_open_pull() { let (tahinli, _token, work) = tahinli_repo_with_main(&b).await; git(&work, &["checkout", "-q", "-b", "feature2"]); - commit( - &work, - "one.txt", - "1\n", - "first on feature2", - TAHINLI, - ); + commit(&work, "one.txt", "1\n", "first on feature2", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/feature2"]); let number = open_pull(&b.http, &tahinli, "main", "feature2", "Feature two").await; - let second = commit( - &work, - "two.txt", - "2\n", - "second on feature2", - TAHINLI, - ); + let second = commit(&work, "two.txt", "2\n", "second on feature2", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/feature2"]); let path = format!("{REPO_PATH}/pulls/{number}"); @@ -444,13 +420,7 @@ async fn pull_pages_follow_writes_live() { let (tahinli, token, work) = tahinli_repo_with_main(&b).await; git(&work, &["checkout", "-q", "-b", "live"]); - let first = commit( - &work, - "live.txt", - "live\n", - "first on live", - TAHINLI, - ); + let first = commit(&work, "live.txt", "live\n", "first on live", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/live"]); let number = open_pull(&b.http, &tahinli, "main", "live", "Live pull").await; let pull = format!("{REPO_PATH}/pulls/{number}"); @@ -514,13 +484,7 @@ async fn pull_pages_follow_writes_live() { next_changed(&mut pull_events, "a review").await; // A push to the head branch updates the pull and the list. - let second = commit( - &work, - "second.txt", - "2\n", - "second on live", - TAHINLI, - ); + let second = commit(&work, "second.txt", "2\n", "second on live", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/live"]); next_changed(&mut pull_events, "a push to the head").await; next_changed(&mut list_events, "a push to the head").await; @@ -593,13 +557,7 @@ async fn fork_pull_squash_merge_credits_contributor() { let bob_url = remote(b.http_port, "bob", &bob_token, "bob", "r"); let bob_work = clone(&bob_url, &b.dir.join("bob-work")); git(&bob_work, &["checkout", "-q", "-b", "bob-feature"]); - let bob_head = commit( - &bob_work, - "bob.txt", - "bob\n", - "Bob change", - BOB, - ); + let bob_head = commit(&bob_work, "bob.txt", "bob\n", "Bob change", BOB); git( &bob_work, &["push", "-q", "origin", "HEAD:refs/heads/bob-feature"], @@ -633,24 +591,12 @@ async fn conflicting_pull_cannot_merge() { // Both sides edit the same line. The pull is opened while main still matches its base. git(&work, &["checkout", "-q", "-b", "conflict"]); - commit( - &work, - "shared.txt", - "branch side\n", - "branch edit", - TAHINLI, - ); + commit(&work, "shared.txt", "branch side\n", "branch edit", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/conflict"]); let number = open_pull(&b.http, &tahinli, "main", "conflict", "Conflicting").await; git(&work, &["checkout", "-q", "main"]); - let main_head = commit( - &work, - "shared.txt", - "main side\n", - "main edit", - TAHINLI, - ); + let main_head = commit(&work, "shared.txt", "main side\n", "main edit", TAHINLI); git(&work, &["push", "-q", "origin", "HEAD:refs/heads/main"]); let path = format!("{REPO_PATH}/pulls/{number}"); diff --git a/crates/forge-e2e/tests/e2e/repo_collaborators_e2e.rs b/crates/forge-e2e/tests/e2e/repo_collaborators_e2e.rs index 2c2ec3f..c488591 100644 --- a/crates/forge-e2e/tests/e2e/repo_collaborators_e2e.rs +++ b/crates/forge-e2e/tests/e2e/repo_collaborators_e2e.rs @@ -244,7 +244,10 @@ async fn repo_collaborators_end_to_end() { .await; assert_eq!(res.status, 303, "unknown user redirects with a notice"); let notice_page = http - .get(page, Some(&with_cookie(&olivia, &res, "forge_collab_notice"))) + .get( + page, + Some(&with_cookie(&olivia, &res, "forge_collab_notice")), + ) .await; assert!( notice_page.body.contains("No user has that username."), @@ -258,7 +261,10 @@ async fn repo_collaborators_end_to_end() { ) .await; let notice_page = http - .get(page, Some(&with_cookie(&olivia, &res, "forge_collab_notice"))) + .get( + page, + Some(&with_cookie(&olivia, &res, "forge_collab_notice")), + ) .await; assert!( notice_page diff --git a/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs b/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs index 6601760..143f7a6 100644 --- a/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs +++ b/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs @@ -871,7 +871,10 @@ async fn general_settings_end_to_end() { .await; assert_eq!(missing.status, 303); let notice_page = http - .get("/bob/gen/settings", Some(&with_cookie(&bob, &missing, "forge_settings_notice"))) + .get( + "/bob/gen/settings", + Some(&with_cookie(&bob, &missing, "forge_settings_notice")), + ) .await; assert!( notice_page.body.contains("That branch does not exist"), @@ -897,7 +900,10 @@ async fn general_settings_end_to_end() { .await; assert_eq!(too_long.status, 303); let long_page = http - .get("/bob/gen/settings", Some(&with_cookie(&bob, &too_long, "forge_settings_notice"))) + .get( + "/bob/gen/settings", + Some(&with_cookie(&bob, &too_long, "forge_settings_notice")), + ) .await; assert!(long_page.body.contains("at most 350 characters")); diff --git a/crates/forge-git/src/wiki.rs b/crates/forge-git/src/wiki.rs index 9b79b4b..26d9dbf 100644 --- a/crates/forge-git/src/wiki.rs +++ b/crates/forge-git/src/wiki.rs @@ -255,7 +255,9 @@ async fn write_commit( Err(Error::Failed(msg)) if msg.contains("but expected") || msg.contains("unable to resolve reference") => { - Err(Error::RefMoved(format!("wiki {WIKI_BRANCH} moved during the edit"))) + Err(Error::RefMoved(format!( + "wiki {WIKI_BRANCH} moved during the edit" + ))) } Err(e) => Err(e), } diff --git a/crates/forge-ssh/src/server.rs b/crates/forge-ssh/src/server.rs index f6dbeab..103563d 100644 --- a/crates/forge-ssh/src/server.rs +++ b/crates/forge-ssh/src/server.rs @@ -83,22 +83,20 @@ pub async fn run(config: SshConfig, backend: Arc) -> Result<() let russh_config = Arc::clone(&russh_config); tokio::spawn(async move { let _permit = permit; - let running = match tokio::time::timeout( - AUTH_TIMEOUT, - run_stream(russh_config, stream, client), - ) - .await - { - Ok(Ok(running)) => running, - Ok(Err(e)) => { - tracing::debug!(%peer, error = %e, "ssh handshake failed"); - return; - } - Err(_) => { - tracing::debug!(%peer, "ssh handshake timed out"); - return; - } - }; + let running = + match tokio::time::timeout(AUTH_TIMEOUT, run_stream(russh_config, stream, client)) + .await + { + Ok(Ok(running)) => running, + Ok(Err(e)) => { + tracing::debug!(%peer, error = %e, "ssh handshake failed"); + return; + } + Err(_) => { + tracing::debug!(%peer, "ssh handshake timed out"); + return; + } + }; let handle = running.handle(); tokio::spawn(async move { tokio::time::sleep(AUTH_TIMEOUT).await; diff --git a/crates/forge-web-account/src/pages/admin_replication.rs b/crates/forge-web-account/src/pages/admin_replication.rs index 149156c..808cd00 100644 --- a/crates/forge-web-account/src/pages/admin_replication.rs +++ b/crates/forge-web-account/src/pages/admin_replication.rs @@ -313,7 +313,14 @@ async fn page_fingerprint(state: &AppState) -> Result { let rows: Vec<_> = data .repos .iter() - .map(|row| (&row.name, row.kind.label(Lang::En), &row.last_ok, &row.error)) + .map(|row| { + ( + &row.name, + row.kind.label(Lang::En), + &row.last_ok, + &row.error, + ) + }) .collect(); Ok(format!( "{}|{}|{:?}|{:?}|{}|{:?}", diff --git a/crates/forge-web-account/src/pages/assets.rs b/crates/forge-web-account/src/pages/assets.rs index cf2ffb1..ad90c0e 100644 --- a/crates/forge-web-account/src/pages/assets.rs +++ b/crates/forge-web-account/src/pages/assets.rs @@ -41,7 +41,11 @@ const CSS: &str = forge_web_app::build_info::MAIN_CSS; /// Immutable when the URL carries the current content hash, so a changed file gets a new URL. #[route(GET "/assets/main.css")] async fn main_css(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static str)> { - Ok(respond("text/css; charset=utf-8", cache_for(cx, STYLESHEET_HREF), CSS)) + Ok(respond( + "text/css; charset=utf-8", + cache_for(cx, STYLESHEET_HREF), + CSS, + )) } /// The soft-navigation script (`assets/nav.js`). Served from the same origin, so the CSP's @@ -51,7 +55,11 @@ const NAV_JS: &str = include_str!("../../../forge-web/assets/nav.js"); /// Immutable like `main.css`: the URL carries a content hash. #[route(GET "/assets/nav.js")] async fn nav_js(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static str)> { - Ok(respond("text/javascript; charset=utf-8", cache_for(cx, NAV_SCRIPT_HREF), NAV_JS)) + Ok(respond( + "text/javascript; charset=utf-8", + cache_for(cx, NAV_SCRIPT_HREF), + NAV_JS, + )) } /// Immutable like `main.css`: the URL carries a content hash. @@ -105,12 +113,20 @@ const OFFLINE_JS: &str = include_str!("../../../forge-web/assets/offline.js"); #[route(GET "/assets/offline.html")] async fn offline_html(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static str)> { - Ok(respond("text/html; charset=utf-8", "no-cache", OFFLINE_HTML)) + Ok(respond( + "text/html; charset=utf-8", + "no-cache", + OFFLINE_HTML, + )) } #[route(GET "/assets/offline.js")] async fn offline_js(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static str)> { - Ok(respond("text/javascript; charset=utf-8", "no-cache", OFFLINE_JS)) + Ok(respond( + "text/javascript; charset=utf-8", + "no-cache", + OFFLINE_JS, + )) } /// The stream every page and the offline page watch to learn that the server is back. It carries @@ -190,17 +206,29 @@ async fn plex_mono_400_italic(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'stati #[route(GET "/assets/fonts/Figtree-OFL.txt")] async fn figtree_license(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static [u8])> { - Ok(respond("text/plain; charset=utf-8", LICENSE_CACHE, FIGTREE_LICENSE)) + Ok(respond( + "text/plain; charset=utf-8", + LICENSE_CACHE, + FIGTREE_LICENSE, + )) } #[route(GET "/assets/fonts/Archivo-OFL.txt")] async fn archivo_license(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static [u8])> { - Ok(respond("text/plain; charset=utf-8", LICENSE_CACHE, ARCHIVO_LICENSE)) + Ok(respond( + "text/plain; charset=utf-8", + LICENSE_CACHE, + ARCHIVO_LICENSE, + )) } #[route(GET "/assets/fonts/IBMPlexMono-OFL.txt")] async fn plex_mono_license(cx: &Cx) -> Result<(StatusCode, HeaderMap, &'static [u8])> { - Ok(respond("text/plain; charset=utf-8", LICENSE_CACHE, PLEX_MONO_LICENSE)) + Ok(respond( + "text/plain; charset=utf-8", + LICENSE_CACHE, + PLEX_MONO_LICENSE, + )) } #[cfg(test)] diff --git a/crates/forge-web-account/src/pages/login.rs b/crates/forge-web-account/src/pages/login.rs index c4216f8..938ec9c 100644 --- a/crates/forge-web-account/src/pages/login.rs +++ b/crates/forge-web-account/src/pages/login.rs @@ -2,8 +2,8 @@ use std::time::{Duration, Instant}; -use forge_core::{AuditAction, User}; use forge_core::names::normalize_name; +use forge_core::{AuditAction, User}; use http::header::{HeaderValue, RETRY_AFTER}; use serde::Deserialize; use serde_json::json; diff --git a/crates/forge-web-account/src/pages/new_repo.rs b/crates/forge-web-account/src/pages/new_repo.rs index 83e94fb..0f0941d 100644 --- a/crates/forge-web-account/src/pages/new_repo.rs +++ b/crates/forge-web-account/src/pages/new_repo.rs @@ -7,9 +7,9 @@ use serde::Deserialize; use topcoat::Result; use topcoat::context::{Cx, context}; use topcoat::router::content::Form; -use topcoat::router::error::see_other; #[allow(unused_imports)] use topcoat::router::error::bad_request; +use topcoat::router::error::see_other; use topcoat::router::{page, query_params}; use topcoat::view::{View, component, view}; diff --git a/crates/forge-web-account/src/pages/org_members.rs b/crates/forge-web-account/src/pages/org_members.rs index 96f0bd0..f7712ac 100644 --- a/crates/forge-web-account/src/pages/org_members.rs +++ b/crates/forge-web-account/src/pages/org_members.rs @@ -19,8 +19,8 @@ use crate::audit::{self, Actor, Target}; use crate::i18n::orgs::{self as g, K}; use crate::i18n::{self, Lang}; use crate::pages::org_ctx::{ - load_org, notice_href, org_notice, org_tab_counts, org_tabs, require_form_csrf, - require_member, require_owner, take_notice, + load_org, notice_href, org_notice, org_tab_counts, org_tabs, require_form_csrf, require_member, + require_owner, take_notice, }; use crate::state::AppState; use crate::views::parts::{PeopleList, PersonRow, SubPart, head, people_list}; diff --git a/crates/forge-web-account/src/pages/profile.rs b/crates/forge-web-account/src/pages/profile.rs index 12dcd9e..ecae6cf 100644 --- a/crates/forge-web-account/src/pages/profile.rs +++ b/crates/forge-web-account/src/pages/profile.rs @@ -236,7 +236,13 @@ async fn profile_page(cx: &Cx) -> Result { let snippet_pages = snippet_total.div_ceil(PER_PAGE).max(1); let snippet_page = page.min(snippet_pages); let snippet_pager = pager_links(snippet_page, snippet_pages, |n| { - profile_href(&user.username, Tab::Snippets.key(), &Finder::default(), SORTS[0].0, n) + profile_href( + &user.username, + Tab::Snippets.key(), + &Finder::default(), + SORTS[0].0, + n, + ) }); let snippets: Vec = snippets .into_iter() diff --git a/crates/forge-web-account/src/pages/releases_tests.rs b/crates/forge-web-account/src/pages/releases_tests.rs index 59b9b5e..ff4325b 100644 --- a/crates/forge-web-account/src/pages/releases_tests.rs +++ b/crates/forge-web-account/src/pages/releases_tests.rs @@ -443,8 +443,7 @@ async fn creating_and_retagging_releases_take_tags_and_targets() { draft: false, prerelease: false, }; - let refused = - release_ops::create(&fx.state, &fx.repo, &fx.tahinli, input("a/b", "main")).await; + let refused = release_ops::create(&fx.state, &fx.repo, &fx.tahinli, input("a/b", "main")).await; assert!( matches!(refused, Err(ReleaseError::Invalid(_))), "bad tag: {refused:?}" @@ -539,8 +538,7 @@ async fn creating_and_retagging_releases_take_tags_and_targets() { target: Some("next".to_owned()), ..keep(&draft) }; - let refused = - release_ops::update(&fx.state, &fx.repo, &fx.tahinli, &draft, clash_target).await; + let refused = release_ops::update(&fx.state, &fx.repo, &fx.tahinli, &draft, clash_target).await; assert!( matches!(refused, Err(ReleaseError::Invalid(_))), "{refused:?}" diff --git a/crates/forge-web-account/src/pages/settings_appearance.rs b/crates/forge-web-account/src/pages/settings_appearance.rs index 58d82c6..f5c13f8 100644 --- a/crates/forge-web-account/src/pages/settings_appearance.rs +++ b/crates/forge-web-account/src/pages/settings_appearance.rs @@ -740,7 +740,11 @@ mod tests { assert_eq!(accent_row.stripe.hue, plum_hue, "preset accent: knob hue"); assert!(!base_row.stripe.custom, "preset base: not custom"); assert_eq!(base_row.stripe.hue, ink_hue, "preset base: knob hue"); - let plum = accent_row.choices.iter().find(|c| c.value == "plum").unwrap(); + let plum = accent_row + .choices + .iter() + .find(|c| c.value == "plum") + .unwrap(); assert!(plum.selected, "preset accent: checked"); assert_eq!(plum.hue, plum_hue.to_string(), "preset accent: hue value"); diff --git a/crates/forge-web-account/src/pages/settings_gpg.rs b/crates/forge-web-account/src/pages/settings_gpg.rs index c1049a2..a2b1682 100644 --- a/crates/forge-web-account/src/pages/settings_gpg.rs +++ b/crates/forge-web-account/src/pages/settings_gpg.rs @@ -15,7 +15,7 @@ use crate::audit::{self, Actor, Target}; use crate::auth::require_csrf; use crate::i18n::s; use crate::i18n::{self, Key, Lang, t}; -use crate::pages::settings_keys::{KeyKind, KeysDraft, kind_page, keys_page_view}; +use crate::pages::settings_keys::{KeyKind, KeysDraft, keys_page_view, kind_page}; use crate::signatures; use crate::state::AppState; use crate::views::parts::confirm_act; diff --git a/crates/forge-web-account/src/pages/settings_tokens.rs b/crates/forge-web-account/src/pages/settings_tokens.rs index d3eb260..8c22273 100644 --- a/crates/forge-web-account/src/pages/settings_tokens.rs +++ b/crates/forge-web-account/src/pages/settings_tokens.rs @@ -23,7 +23,7 @@ use crate::i18n::packages::{self as pk, K as PK}; use crate::i18n::releases_ci::{self as rc, K as RC}; use crate::i18n::s; use crate::i18n::{self, Key, Lang, t, token_name_length}; -use crate::pages::settings_keys::{KeyKind, KeysDraft, kind_page, keys_page_view}; +use crate::pages::settings_keys::{KeyKind, KeysDraft, keys_page_view, kind_page}; use crate::state::AppState; use crate::views::parts::confirm_act; use crate::views::{alert, rel_time, rel_time_or_never}; diff --git a/crates/forge-web-app/src/alerts.rs b/crates/forge-web-app/src/alerts.rs index 50428f1..67b36e1 100644 --- a/crates/forge-web-app/src/alerts.rs +++ b/crates/forge-web-app/src/alerts.rs @@ -86,9 +86,10 @@ impl AlertTopic { fn kind(self) -> AlertKind { match self { Self::RunnerOffline => AlertKind::RunnerOffline, - Self::BackupFailed | Self::BackupVerifyFailed | Self::BackupOverdue | Self::FsckFailed => { - AlertKind::Backup - } + Self::BackupFailed + | Self::BackupVerifyFailed + | Self::BackupOverdue + | Self::FsckFailed => AlertKind::Backup, Self::DiskLow => AlertKind::Disk, Self::CiKilled => AlertKind::CiKilled, Self::SelfUpdateRestart | Self::SelfUpdateFailed => AlertKind::SelfUpdate, @@ -491,7 +492,14 @@ async fn check_backup_overdue(state: &AppState, now: i64) { || "never".to_owned(), |t| forge_core::tz::format_in_tz(t, "UTC"), ); - raise(state, AlertTopic::BackupOverdue, "backup_overdue", "", &detail).await; + raise( + state, + AlertTopic::BackupOverdue, + "backup_overdue", + "", + &detail, + ) + .await; } else { resolve(state, "backup_overdue").await; } @@ -634,7 +642,14 @@ mod tests { config.alerts.enabled = false; state.set_config(config); - raise(&state, AlertTopic::BackupFailed, "backup_failed", "", "boom").await; + raise( + &state, + AlertTopic::BackupFailed, + "backup_failed", + "", + "boom", + ) + .await; assert_eq!( inbox(&state, &tahinli).await.len(), 1, diff --git a/crates/forge-web-app/src/api/releases.rs b/crates/forge-web-app/src/api/releases.rs index 01e1b67..5878ea7 100644 --- a/crates/forge-web-app/src/api/releases.rs +++ b/crates/forge-web-app/src/api/releases.rs @@ -132,18 +132,11 @@ async fn get_release_by_tag(cx: &Cx) -> topcoat::Result { #[route(POST "/api/v1/repos/{owner}/{repo}/releases")] async fn create_release(cx: &Cx, body: Body) -> topcoat::Result { let state = context::(cx); - let (repo, user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let input: CreateBody = match api::json_body(body, MAX_JSON_BYTES).await { Ok(input) => input, Err(res) => return Ok(*res), @@ -176,18 +169,11 @@ async fn create_release(cx: &Cx, body: Body) -> topcoat::Result { #[route(PATCH "/api/v1/repos/{owner}/{repo}/releases/{id}")] async fn edit_release(cx: &Cx, body: Body) -> topcoat::Result { let state = context::(cx); - let (repo, user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let release = match release_in_repo(state, &repo, id(cx)).await { Ok(release) => release, Err(res) => return Ok(*res), @@ -217,18 +203,11 @@ async fn edit_release(cx: &Cx, body: Body) -> topcoat::Result { #[route(DELETE "/api/v1/repos/{owner}/{repo}/releases/{id}")] async fn delete_release(cx: &Cx) -> topcoat::Result { let state = context::(cx); - let (repo, user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let release = match release_in_repo(state, &repo, id(cx)).await { Ok(release) => release, Err(res) => return Ok(*res), @@ -243,18 +222,11 @@ async fn delete_release(cx: &Cx) -> topcoat::Result { #[route(PUT "/api/v1/repos/{owner}/{repo}/releases/{id}/assets/{asset}")] async fn upload_asset(cx: &Cx, body: Body) -> topcoat::Result { let state = context::(cx); - let (repo, user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let release = match release_in_repo(state, &repo, id(cx)).await { Ok(release) => release, Err(res) => return Ok(*res), @@ -302,18 +274,11 @@ async fn upload_asset(cx: &Cx, body: Body) -> topcoat::Result { #[route(DELETE "/api/v1/repos/{owner}/{repo}/releases/{id}/assets/{asset}")] async fn delete_asset(cx: &Cx) -> topcoat::Result { let state = context::(cx); - let (repo, _user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, _user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let release = match release_in_repo(state, &repo, id(cx)).await { Ok(release) => release, Err(res) => return Ok(*res), diff --git a/crates/forge-web-app/src/api/statuses.rs b/crates/forge-web-app/src/api/statuses.rs index f6604fe..3117097 100644 --- a/crates/forge-web-app/src/api/statuses.rs +++ b/crates/forge-web-app/src/api/statuses.rs @@ -36,18 +36,11 @@ struct ReportBody { #[route(POST "/api/v1/repos/{owner}/{repo}/statuses/{sha}")] async fn report_status(cx: &Cx, body: Body) -> topcoat::Result { let state = context::(cx); - let (repo, user) = match api::load_writer( - state, - client_ip(cx), - headers(cx), - owner(cx), - repo(cx), - ) - .await - { - Ok(found) => found, - Err(res) => return Ok(*res), - }; + let (repo, user) = + match api::load_writer(state, client_ip(cx), headers(cx), owner(cx), repo(cx)).await { + Ok(found) => found, + Err(res) => return Ok(*res), + }; let Some(sha) = api::normalize_sha(sha(cx)) else { return Ok(not_a_full_sha()); }; diff --git a/crates/forge-web-app/src/backup/mod.rs b/crates/forge-web-app/src/backup/mod.rs index 706dcef..cd80a9f 100644 --- a/crates/forge-web-app/src/backup/mod.rs +++ b/crates/forge-web-app/src/backup/mod.rs @@ -17,8 +17,8 @@ use std::fs::{DirBuilder, File}; use std::os::unix::fs::{DirBuilderExt, OpenOptionsExt, PermissionsExt}; use std::path::{Path, PathBuf}; -use forge_core::{Error, Result, Store}; use forge_core::token::sha256_reader; +use forge_core::{Error, Result, Store}; use forge_git::GitEnv; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; diff --git a/crates/forge-web-app/src/backup/scheduler.rs b/crates/forge-web-app/src/backup/scheduler.rs index 94cca6c..3dc67cf 100644 --- a/crates/forge-web-app/src/backup/scheduler.rs +++ b/crates/forge-web-app/src/backup/scheduler.rs @@ -306,7 +306,15 @@ pub async fn fsck_job(state: &AppState, trigger: RunTrigger, full: bool) -> Resu Err(e) => Some(e.to_string()), }; crate::alerts::fsck_finished(state, problem.as_deref().map_or(Ok(()), Err)).await; - record_finish(state, &run_id, problem.is_none(), None, None, problem.as_deref()).await; + record_finish( + state, + &run_id, + problem.is_none(), + None, + None, + problem.as_deref(), + ) + .await; outcome } diff --git a/crates/forge-web-app/src/ci/api.rs b/crates/forge-web-app/src/ci/api.rs index c9222a8..f6fe352 100644 --- a/crates/forge-web-app/src/ci/api.rs +++ b/crates/forge-web-app/src/ci/api.rs @@ -807,9 +807,7 @@ async fn append_log(cx: &Cx, body: Body) -> topcoat::Result { Err(res) => return Ok(*res), }; match write_log(state, &job, offset, &chunk).await { - Ok(LogWrite::Stored(size)) => { - Ok(api::json(StatusCode::OK, &json!({ "size": size }))) - } + Ok(LogWrite::Stored(size)) => Ok(api::json(StatusCode::OK, &json!({ "size": size }))), Ok(LogWrite::Mismatch(size)) => { let mut res = api::error(StatusCode::CONFLICT, "the log offset does not match"); res.headers_mut().insert( @@ -831,7 +829,12 @@ async fn write_log( chunk: &[u8], ) -> Result { let _guard = LOG_LOCK.lock().await; - let size = match state.store.job_by_id(&job.id).await.map_err(api::internal)? { + let size = match state + .store + .job_by_id(&job.id) + .await + .map_err(api::internal)? + { Some(fresh) => u64::try_from(fresh.log_bytes).unwrap_or(0), None => return Err(api::internal("log for a job that is gone")), }; diff --git a/crates/forge-web-app/src/ci/api_tests.rs b/crates/forge-web-app/src/ci/api_tests.rs index 10fc6ab..0048f4b 100644 --- a/crates/forge-web-app/src/ci/api_tests.rs +++ b/crates/forge-web-app/src/ci/api_tests.rs @@ -1207,7 +1207,6 @@ async fn job_token_reads_over_smart_http_but_never_pushes() { ); } - #[tokio::test] async fn runner_binary_needs_runner_auth_and_self_update() { let env = bare(|_| {}).await; diff --git a/crates/forge-web-app/src/importer/mod.rs b/crates/forge-web-app/src/importer/mod.rs index 15b5c40..1d1bc22 100644 --- a/crates/forge-web-app/src/importer/mod.rs +++ b/crates/forge-web-app/src/importer/mod.rs @@ -889,8 +889,14 @@ impl Run<'_, A> { ) .await?; let kind = if item.is_pr { "pull" } else { "issue" }; - self.record(kind, &item.number.to_string(), &issue.id, &item.author, &item.url) - .await; + self.record( + kind, + &item.number.to_string(), + &issue.id, + &item.author, + &item.url, + ) + .await; let mut ids = Vec::new(); for name in &item.labels { if let Some(id) = self.label_id(labels, name, FALLBACK_LABEL_COLOR).await { diff --git a/crates/forge-web-app/src/layers.rs b/crates/forge-web-app/src/layers.rs index a141313..f7e6ad5 100644 --- a/crates/forge-web-app/src/layers.rs +++ b/crates/forge-web-app/src/layers.rs @@ -1,8 +1,8 @@ use std::fmt; use topcoat::context::Cx; -use topcoat::router::request::{method, uri}; use topcoat::router::Method; +use topcoat::router::request::{method, uri}; use crate::live::Topic; use crate::state::AppState; diff --git a/crates/forge-web-app/src/mail/worker.rs b/crates/forge-web-app/src/mail/worker.rs index d128632..17971e4 100644 --- a/crates/forge-web-app/src/mail/worker.rs +++ b/crates/forge-web-app/src/mail/worker.rs @@ -74,7 +74,11 @@ async fn tick(state: &AppState) -> forge_core::Result { deliver(state, &entry).await; } let next = state.store.next_mail_due().await?; - Ok(sleep_until(next.as_deref(), OffsetDateTime::now_utc(), BACKSTOP)) + Ok(sleep_until( + next.as_deref(), + OffsetDateTime::now_utc(), + BACKSTOP, + )) } /// Sends one leased message and records the outcome. diff --git a/crates/forge-web-app/src/raw/media.rs b/crates/forge-web-app/src/raw/media.rs index b60023e..2450624 100644 --- a/crates/forge-web-app/src/raw/media.rs +++ b/crates/forge-web-app/src/raw/media.rs @@ -14,8 +14,8 @@ use topcoat::router::{ use crate::lfs::{has_object, object_path}; use crate::lfs_pointer; use crate::raw::{ - CACHE_NONE, Lookup, Meta, OCTET, TokenQuery, encode_path, finish, lookup, plain, - resolve_repo, signed_url, + CACHE_NONE, Lookup, Meta, OCTET, TokenQuery, encode_path, finish, lookup, plain, resolve_repo, + signed_url, }; use crate::state::AppState; @@ -51,11 +51,11 @@ async fn serve(cx: &Cx) -> Response { .ok() .and_then(|query| query.token); - let (repo, repo_dir, cache) = - match resolve_repo(&state, &owner, &name, token.as_deref()).await { - Ok(found) => found, - Err(response) => return response, - }; + let (repo, repo_dir, cache) = match resolve_repo(&state, &owner, &name, token.as_deref()).await + { + Ok(found) => found, + Err(response) => return response, + }; let looked = tokio::task::spawn_blocking(move || lookup(&repo_dir, &rest, None)).await; let data = match looked { diff --git a/crates/forge-web-app/src/raw/snippet_raw.rs b/crates/forge-web-app/src/raw/snippet_raw.rs index ef3893b..7b673c7 100644 --- a/crates/forge-web-app/src/raw/snippet_raw.rs +++ b/crates/forge-web-app/src/raw/snippet_raw.rs @@ -10,8 +10,8 @@ use topcoat::router::{ }; use crate::raw::{ - CACHE_NONE, CACHE_PRIVATE, CACHE_PUBLIC, Meta, TEXT, TokenQuery, encode_path, finish, - now_unix, plain, signed_url, + CACHE_NONE, CACHE_PRIVATE, CACHE_PUBLIC, Meta, TEXT, TokenQuery, encode_path, finish, now_unix, + plain, signed_url, }; use crate::state::AppState; diff --git a/crates/forge-web-app/src/web_push/mod.rs b/crates/forge-web-app/src/web_push/mod.rs index 62d4917..e54a0c5 100644 --- a/crates/forge-web-app/src/web_push/mod.rs +++ b/crates/forge-web-app/src/web_push/mod.rs @@ -54,7 +54,10 @@ pub enum Alert { count: u64, url: String, }, - Admin { subject: String, detail: String }, + Admin { + subject: String, + detail: String, + }, Test, } diff --git a/crates/forge-web-base/src/accent.rs b/crates/forge-web-base/src/accent.rs index b01d45c..99259c0 100644 --- a/crates/forge-web-base/src/accent.rs +++ b/crates/forge-web-base/src/accent.rs @@ -35,10 +35,7 @@ pub fn ids() -> impl Iterator { /// The preset base for a stored id. An unknown or removed id, and a `hue-N` id, fall back to the /// default. A page shows `base_id` instead, which keeps a hue. pub fn resolve_base(stored: &str) -> &'static Base { - BASES - .iter() - .find(|b| b.id == stored) - .unwrap_or(&BASES[0]) + BASES.iter().find(|b| b.id == stored).unwrap_or(&BASES[0]) } /// The base id a page shows for a stored one: the id itself when forge offers it (a preset or a diff --git a/crates/forge-web-pages/src/pages/admin_runners.rs b/crates/forge-web-pages/src/pages/admin_runners.rs index 2578886..5a7efe9 100644 --- a/crates/forge-web-pages/src/pages/admin_runners.rs +++ b/crates/forge-web-pages/src/pages/admin_runners.rs @@ -1088,8 +1088,14 @@ async fn runner_job_rows( .iter() .partition(|job| job.job.state == JobState::Running); Ok(( - running.into_iter().map(|job| runner_job_row(lang, job)).collect(), - finished.into_iter().map(|job| runner_job_row(lang, job)).collect(), + running + .into_iter() + .map(|job| runner_job_row(lang, job)) + .collect(), + finished + .into_iter() + .map(|job| runner_job_row(lang, job)) + .collect(), )) } @@ -1358,7 +1364,10 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie let net = mx_chart( &points, net_top, - &[(|b: &Bucket| b.rx, "mx-line"), (|b: &Bucket| b.tx, "mx-line mx-line-sent")], + &[ + (|b: &Bucket| b.rx, "mx-line"), + (|b: &Bucket| b.tx, "mx-line mx-line-sent"), + ], false, &rate_text, &|b| { diff --git a/crates/forge-web-pages/src/pages/ci_runs.rs b/crates/forge-web-pages/src/pages/ci_runs.rs index a25e186..a79299c 100644 --- a/crates/forge-web-pages/src/pages/ci_runs.rs +++ b/crates/forge-web-pages/src/pages/ci_runs.rs @@ -3051,7 +3051,12 @@ async fn run_artifacts_zip(cx: &Cx) -> Result { .map_err(forge_core::Error::Io)?; let mut res = Response::new(topcoat::router::Body::from(zipped)); let file = format!("{}-run-{}-artifacts.zip", ctx.repo.name, run.number); - attachment_headers(res.headers_mut(), "application/zip", &file, "private, no-cache"); + attachment_headers( + res.headers_mut(), + "application/zip", + &file, + "private, no-cache", + ); Ok(res) } diff --git a/crates/forge-web-pages/src/pages/edit_history.rs b/crates/forge-web-pages/src/pages/edit_history.rs index 9fe1115..d627f78 100644 --- a/crates/forge-web-pages/src/pages/edit_history.rs +++ b/crates/forge-web-pages/src/pages/edit_history.rs @@ -63,7 +63,12 @@ pub async fn thread_edit_counts( .flat_map(|thread| std::iter::once(&thread.root).chain(thread.replies.iter())) .map(|comment| comment.id.as_str()) .collect(); - Ok(Arc::new(state.store.edit_count(EditTarget::ReviewComment, &ids).await?)) + Ok(Arc::new( + state + .store + .edit_count(EditTarget::ReviewComment, &ids) + .await?, + )) } /// One line of a diff: its CSS class from the `diff-*` set and its text with its sign. diff --git a/crates/forge-web-pages/src/pages/issue_parts.rs b/crates/forge-web-pages/src/pages/issue_parts.rs index 7d1f18c..c3507b8 100644 --- a/crates/forge-web-pages/src/pages/issue_parts.rs +++ b/crates/forge-web-pages/src/pages/issue_parts.rs @@ -61,7 +61,6 @@ impl ItemKind { } } - pub fn viewer(ctx: &RepoCtx) -> Option<&User> { ctx.viewer.as_ref().map(|(user, _)| user) } @@ -124,7 +123,6 @@ pub fn csrf_of(ctx: &RepoCtx) -> String { .unwrap_or_default() } - /// Parses an issue number: digits only, greater than zero. Anything else is 404. pub fn parse_number(raw: &str) -> Result { match raw.parse::() { @@ -188,7 +186,6 @@ pub async fn reachable_among(path: &std::path::Path, oids: Vec) -> HashS .unwrap_or_default() } - /// One comment, or the item body (which uses the same item shape without a delete action). pub struct CommentView { anchor: String, @@ -761,7 +758,10 @@ pub async fn load_discussion( }; let body_anchor = kind.anchor(number); let opened = When::new(lang, &item.created_at, &tz, now); - let body_edits = state.store.edit_count(EditTarget::Issue, &[item.id.as_str()]).await?; + let body_edits = state + .store + .edit_count(EditTarget::Issue, &[item.id.as_str()]) + .await?; let body_history = body_edits .get(&item.id) .is_some_and(|count| *count > 0) @@ -795,7 +795,10 @@ pub async fn load_discussion( }; let comment_ids: Vec<&str> = comments.iter().map(|c| c.id.as_str()).collect(); - let comment_edits = state.store.edit_count(EditTarget::Comment, &comment_ids).await?; + let comment_edits = state + .store + .edit_count(EditTarget::Comment, &comment_ids) + .await?; let mut keyed: Vec<(String, Entry)> = Vec::new(); for comment in comments { let (who_name, hash) = who(&comment.author_id); @@ -811,10 +814,16 @@ pub async fn load_discussion( avatar: avatar_url(&who_name, hash.as_deref()), when: When::new(lang, &comment.created_at, &tz, now), html: render_markdown(&comment.body, Some(&link)), - history_href: edited - .then(|| { - history_href(&owner, &name, kind, number, EditTarget::Comment, &comment.id) - }), + history_href: edited.then(|| { + history_href( + &owner, + &name, + kind, + number, + EditTarget::Comment, + &comment.id, + ) + }), edit_href: mine .then(|| repo_href(&owner, &name, segment, &format!("{comment_path}/edit"))), delete_href: mine @@ -1106,7 +1115,6 @@ async fn review_entries( Ok(keyed) } - pub struct LabelRow { id: String, name: String, @@ -1443,7 +1451,6 @@ pub async fn item_sidebar( }) } - /// The id of the comment form. The head's Close and Reopen buttons post it with `form=`, so a /// close can carry the draft text as its comment, as it always did. pub const COMMENT_FORM: &str = "item-comment"; @@ -1509,7 +1516,6 @@ pub async fn comment_form( }) } - /// The form fields of a comment or state POST. #[derive(Deserialize)] pub struct CommentForm { diff --git a/crates/forge-web-pages/src/pages/issues_list.rs b/crates/forge-web-pages/src/pages/issues_list.rs index 9014fec..41a15b2 100644 --- a/crates/forge-web-pages/src/pages/issues_list.rs +++ b/crates/forge-web-pages/src/pages/issues_list.rs @@ -912,8 +912,8 @@ async fn new_issue_submit(cx: &Cx, RawForm(raw): RawForm) -> Result { .await?; if can_triage(&ctx) && !picked.is_empty() - && let Err(e) = set_picked_labels(state, &ctx.repo.id, &issue.id, &viewer.0.id, &picked) - .await + && let Err(e) = + set_picked_labels(state, &ctx.repo.id, &issue.id, &viewer.0.id, &picked).await { tracing::error!(error = %e, issue_id = %issue.id, "new issue: labels not set"); } diff --git a/crates/forge-web-pages/src/pages/packages.rs b/crates/forge-web-pages/src/pages/packages.rs index 3c597e7..dd921b8 100644 --- a/crates/forge-web-pages/src/pages/packages.rs +++ b/crates/forge-web-pages/src/pages/packages.rs @@ -293,7 +293,11 @@ async fn package_view(cx: &Cx, page: PackagePage) -> Result { let has_versions = !versions.is_empty(); let install = pk::t(lang, K::Install); let install_cmds = [ - (pk::t(lang, K::InstallRegistryConfig), "pkg-config", config_block), + ( + pk::t(lang, K::InstallRegistryConfig), + "pkg-config", + config_block, + ), (pk::t(lang, K::InstallAdd), "pkg-add", add_cmd), (pk::t(lang, K::InstallPublish), "pkg-publish", publish_cmd), (pk::t(lang, K::InstallLogin), "pkg-login", login_cmd), diff --git a/crates/forge-web-repo/src/pages/authoring_tests.rs b/crates/forge-web-repo/src/pages/authoring_tests.rs index 3b12562..3201879 100644 --- a/crates/forge-web-repo/src/pages/authoring_tests.rs +++ b/crates/forge-web-repo/src/pages/authoring_tests.rs @@ -206,7 +206,11 @@ async fn scenario_task_toggles(fx: &Fixture) { .unwrap() .unwrap(); assert_eq!(now.body, "- [ ] one\n- [x] two\n"); - let history = fx.store.edit_history(EditTarget::Issue, &issue.id).await.unwrap(); + let history = fx + .store + .edit_history(EditTarget::Issue, &issue.id) + .await + .unwrap(); assert_eq!(history.len(), 1); assert_eq!(history[0].old_body, "- [ ] one\n- [ ] two\n"); diff --git a/crates/forge-web-repo/src/pages/commits.rs b/crates/forge-web-repo/src/pages/commits.rs index 9cecf55..57600b9 100644 --- a/crates/forge-web-repo/src/pages/commits.rs +++ b/crates/forge-web-repo/src/pages/commits.rs @@ -363,8 +363,8 @@ mod tests { use crate::i18n::Lang; use crate::test_support::fixture::{Fixture, OWNER, REPO, get, git}; - use crate::views::relative_time; use crate::views::enc; + use crate::views::relative_time; #[test] fn dates_and_relative_units_format() { diff --git a/crates/forge-web-repo/src/pages/pull_branch.rs b/crates/forge-web-repo/src/pages/pull_branch.rs index b646198..ced2439 100644 --- a/crates/forge-web-repo/src/pages/pull_branch.rs +++ b/crates/forge-web-repo/src/pages/pull_branch.rs @@ -156,9 +156,7 @@ async fn head_writable( Ok(!head.archived && authorize(Some(user), head, role, org_role, Action::Write).is_ok()) } -fn cas_refusal( - result: forge_git::error::Result<()>, -) -> forge_core::Result> { +fn cas_refusal(result: forge_git::error::Result<()>) -> forge_core::Result> { match result { Ok(()) => Ok(None), Err(forge_git::error::Error::RefMoved(_)) => Ok(Some(ERR_MOVED)), @@ -231,9 +229,9 @@ async fn restore_branch( if read_commit(&path, &pr.head_oid)?.is_none() { return Ok(Some(ERR_MISSING)); } - if let Some(code) = cas_refusal( - update_ref_cas(&state.git, &path, &refname, &pr.head_oid, ZERO_OID).await, - )? { + if let Some(code) = + cas_refusal(update_ref_cas(&state.git, &path, &refname, &pr.head_oid, ZERO_OID).await)? + { return Ok(Some(code)); } record_ref_change(state, head, user, &refname, ZERO_OID, &pr.head_oid).await; diff --git a/crates/forge-web-repo/src/pages/pulls_list.rs b/crates/forge-web-repo/src/pages/pulls_list.rs index a138da4..0de0036 100644 --- a/crates/forge-web-repo/src/pages/pulls_list.rs +++ b/crates/forge-web-repo/src/pages/pulls_list.rs @@ -24,8 +24,7 @@ use crate::pages::repo_ctx::load_repo; use crate::state::AppState; use crate::views::parts::{RailItem, SubPart, rail}; use crate::views::{ - avatar_url_unknown, iso_time, now_unix, relative_time, repo_href, shell, stamp_unix, - user_link, + avatar_url_unknown, iso_time, now_unix, relative_time, repo_href, shell, stamp_unix, user_link, }; path_param!(owner); diff --git a/crates/forge-web/src/admin_cli.rs b/crates/forge-web/src/admin_cli.rs index f7afd27..5f2820a 100644 --- a/crates/forge-web/src/admin_cli.rs +++ b/crates/forge-web/src/admin_cli.rs @@ -255,10 +255,7 @@ pub async fn reset_password(config_path: &Path, username: &str) -> forge_core::R } /// The store-level part of [`reset_password`]. Returns the new password and the display name. -async fn reset_password_in( - store: &Store, - username: &str, -) -> forge_core::Result<(String, String)> { +async fn reset_password_in(store: &Store, username: &str) -> forge_core::Result<(String, String)> { let user = store .user_by_username(username) .await? diff --git a/crates/forge-web/src/importer_route_tests.rs b/crates/forge-web/src/importer_route_tests.rs index dc3ea39..ca5c4c8 100644 --- a/crates/forge-web/src/importer_route_tests.rs +++ b/crates/forge-web/src/importer_route_tests.rs @@ -351,10 +351,7 @@ async fn full_api_import_brings_issues_pulls_comments_labels_and_releases() { let job = store.import_job(&job.id).await.unwrap().unwrap(); assert_eq!(job.state, ImportState::Done, "{:?}", job.error); - let (items, total) = store - .list_issues(&fx.repo.id, &all_issues()) - .await - .unwrap(); + let (items, total) = store.list_issues(&fx.repo.id, &all_issues()).await.unwrap(); assert_eq!(total, 2); let issue = items.iter().find(|i| i.issue.title == "It breaks").unwrap(); assert_eq!(issue.issue.state, IssueState::Closed); @@ -413,10 +410,7 @@ async fn full_api_import_brings_issues_pulls_comments_labels_and_releases() { .await; let again = store.import_job(&again.id).await.unwrap().unwrap(); assert_eq!(again.state, ImportState::Done, "{:?}", again.error); - let (items, total) = store - .list_issues(&fx.repo.id, &all_issues()) - .await - .unwrap(); + let (items, total) = store.list_issues(&fx.repo.id, &all_issues()).await.unwrap(); assert_eq!(total, 2); let first = items.iter().find(|i| i.issue.title == "It breaks").unwrap(); assert_eq!(store.list_comments(&first.issue.id).await.unwrap().len(), 1); diff --git a/crates/forge-web/src/page_route_tests/repo.rs b/crates/forge-web/src/page_route_tests/repo.rs index e803917..e270e0c 100644 --- a/crates/forge-web/src/page_route_tests/repo.rs +++ b/crates/forge-web/src/page_route_tests/repo.rs @@ -133,7 +133,12 @@ async fn demo_pages_render_from_the_repo_contents() { body.contains("markdown-body") && body.contains(""), "GFM table rendered" ); - let (status, body) = get_as(&router, "/tahinli/demo/blob/main/docs/guide.md?plain=1", None).await; + let (status, body) = get_as( + &router, + "/tahinli/demo/blob/main/docs/guide.md?plain=1", + None, + ) + .await; assert_eq!(status, 200); assert!(body.contains("file-table"), "source shown as lines"); assert!(!body.contains("markdown-body"), "not rendered");