anvilsign in

collin/anvil · 3447f00b

style: merge imports per crate (rustfmt imports_granularity)

Collin Richards · 2026-06-10 09:17 UTC · 3447f00bf66f05b33802a1e2591a0e71d4d692cc · parent 1f463de5 · browse files

modifiedcrates/anvil-core/src/sessions.rs+6 −4
⋯ 5 unchanged lines
66 RngCore,
77 };
88
9-use crate::error::Result;
10-use crate::models::{
11- Session,
12- User,
9+use crate::{
10+ error::Result,
11+ models::{
12+ Session,
13+ User,
14+ },
1315 };
1416
1517 /// Default session lifetime: 30 days.
⋯ 64 unchanged lines
modifiedcrates/anvil-core/src/ssh_keys.rs+6 −4
⋯ 5 unchanged lines
66 PublicKey,
77 };
88
9-use crate::error::{
10- Error,
11- Result,
9+use crate::{
10+ error::{
11+ Error,
12+ Result,
13+ },
14+ models::SshKey,
1215 };
13-use crate::models::SshKey;
1416
1517 /// Parse an OpenSSH public-key line (`ssh-ed25519 AAAA… comment`) into its
1618 /// canonical SHA256 fingerprint and normalized key line, for registration.
⋯ 82 unchanged lines
modifiedcrates/anvil-core/src/users.rs+15 −11
11 //! User accounts: creation, lookup, and password hashing.
22
3-use argon2::Argon2;
4-use argon2::password_hash::rand_core::OsRng;
5-use argon2::password_hash::{
6- PasswordHash,
7- PasswordHasher,
8- PasswordVerifier,
9- SaltString,
3+use argon2::{
4+ Argon2,
5+ password_hash::{
6+ PasswordHash,
7+ PasswordHasher,
8+ PasswordVerifier,
9+ SaltString,
10+ rand_core::OsRng,
11+ },
1012 };
1113
12-use crate::error::{
13- Error,
14- Result,
14+use crate::{
15+ error::{
16+ Error,
17+ Result,
18+ },
19+ models::User,
1520 };
16-use crate::models::User;
1721
1822 /// Usernames reserved for system use — they collide with (or could be confused
1923 /// for) top-level routes such as the `/-/…` namespace.
⋯ 93 unchanged lines
modifiedcrates/anvil-git/src/smart_http.rs+5 −3
⋯ 9 unchanged lines
1010 //! for fetch (the modern default) with a v0 fallback, and the classic v0
1111 //! advertisement for `receive-pack` (push).
1212
13-use std::path::Path;
14-use std::pin::Pin;
13+use std::{
14+ path::Path,
15+ pin::Pin,
16+};
1517
16-use gitserver_core::backend::GitBackend;
1718 use gitserver_core::{
19+ backend::GitBackend,
1820 pack,
1921 pktline,
2022 protocol_v2,
⋯ 135 unchanged lines
modifiedcrates/anvil-git/src/ssh.rs+7 −5
⋯ 18 unchanged lines
1919 AsyncWriteExt,
2020 };
2121
22-use crate::error::Result;
23-use crate::smart_http::{
24- self,
25- Service,
26- UploadPack,
22+use crate::{
23+ error::Result,
24+ smart_http::{
25+ self,
26+ Service,
27+ UploadPack,
28+ },
2729 };
2830
2931 /// Parse an SSH `exec` command such as `git-upload-pack '/alice/hello.git'`,
⋯ 199 unchanged lines
modifiedcrates/anvil-git/src/trigger.rs+4 −2
⋯ 4 unchanged lines
55 //! branch tips *before* the push, then call [`enqueue_ci_for_push`] after it
66 //! succeeds.
77
8-use std::collections::HashMap;
9-use std::path::Path;
8+use std::{
9+ collections::HashMap,
10+ path::Path,
11+};
1012
1113 /// Local branch short-name → tip commit id (hex).
1214 pub type BranchTips = HashMap<String, String>;
⋯ 54 unchanged lines
modifiedrustfmt.toml+1 −0
⋯ 4 unchanged lines
55
66 group_imports = "StdExternalCrate"
77 imports_layout = "Vertical"
8+imports_granularity = "Crate"
modifiedvendor/gitserver-core/src/backend.rs+25 −17
1-use std::path::PathBuf;
2-use std::pin::Pin;
3-use std::sync::Arc;
4-use std::sync::atomic::{
5- AtomicBool,
6- Ordering,
7-};
8-use std::task::{
9- Context,
10- Poll,
1+use std::{
2+ path::PathBuf,
3+ pin::Pin,
4+ sync::{
5+ Arc,
6+ atomic::{
7+ AtomicBool,
8+ Ordering,
9+ },
10+ },
11+ task::{
12+ Context,
13+ Poll,
14+ },
1115 };
1216
13-use tokio::io::AsyncRead;
14-use tokio::time::{
15- Duration,
16- Sleep,
17- sleep,
17+use tokio::{
18+ io::AsyncRead,
19+ time::{
20+ Duration,
21+ Sleep,
22+ sleep,
23+ },
1824 };
1925 use tokio_util::io::SyncIoBridge;
2026
21-use crate::error::Result;
22-use crate::pack::UploadPackRequest;
27+use crate::{
28+ error::Result,
29+ pack::UploadPackRequest,
30+};
2331
2432 pub const RECEIVE_PACK_TIMEOUT: Duration = Duration::from_secs(300);
2533 const RECEIVE_PACK_IDLE_TIMEOUT: Duration = Duration::from_secs(30);
⋯ 226 unchanged lines
modifiedvendor/gitserver-core/src/discovery.rs+10 −6
1-use std::fs;
2-use std::path::{
3- Path,
4- PathBuf,
1+use std::{
2+ fs,
3+ path::{
4+ Path,
5+ PathBuf,
6+ },
57 };
68
79 use serde::Serialize;
⋯ 169 unchanged lines
177179
178180 #[cfg(test)]
179181 mod tests {
180- use std::path::Path;
181- use std::process::Command;
182+ use std::{
183+ path::Path,
184+ process::Command,
185+ };
182186
183187 use tempfile::TempDir;
184188
⋯ 121 unchanged lines
modifiedvendor/gitserver-core/src/dynamic_registry.rs+22 −16
⋯ 3 unchanged lines
44 //
55 // Copyright (c) 2026 WJQSERVER
66
7-use std::path::{
8- Path,
9- PathBuf,
10-};
11-use std::sync::{
12- Arc,
13- RwLock,
7+use std::{
8+ path::{
9+ Path,
10+ PathBuf,
11+ },
12+ sync::{
13+ Arc,
14+ RwLock,
15+ },
1416 };
1517
16-use crate::discovery::{
17- RepoInfo,
18- RepoStore,
19-};
20-use crate::error::{
21- Error,
22- Result,
18+use crate::{
19+ discovery::{
20+ RepoInfo,
21+ RepoStore,
22+ },
23+ error::{
24+ Error,
25+ Result,
26+ },
2327 };
2428
2529 pub trait RepoResolver: Send + Sync {
⋯ 123 unchanged lines
149153
150154 #[cfg(test)]
151155 mod tests {
152- use std::path::Path;
153- use std::process::Command;
156+ use std::{
157+ path::Path,
158+ process::Command,
159+ };
154160
155161 use tempfile::TempDir;
156162
⋯ 119 unchanged lines
modifiedvendor/gitserver-core/src/pack.rs+16 −10
1-use std::collections::HashSet;
2-use std::path::Path;
1+use std::{
2+ collections::HashSet,
3+ path::Path,
4+};
35
46 use bytes::Bytes;
57 use sha1::{
⋯ 3 unchanged lines
911 use tokio::io::AsyncRead;
1012 use tokio_util::io::StreamReader;
1113
12-use crate::error::{
13- Error,
14- Result,
14+use crate::{
15+ error::{
16+ Error,
17+ Result,
18+ },
19+ pktline,
1520 };
16-use crate::pktline;
1721
1822 #[derive(Clone, Debug, Default)]
1923 pub struct UploadPackCapabilities {
⋯ 636 unchanged lines
656660
657661 #[cfg(test)]
658662 mod tests {
659- use std::path::{
660- Path,
661- PathBuf,
663+ use std::{
664+ path::{
665+ Path,
666+ PathBuf,
667+ },
668+ process::Command,
662669 };
663- use std::process::Command;
664670
665671 use tempfile::TempDir;
666672 use tokio::io::AsyncReadExt;
⋯ 182 unchanged lines
modifiedvendor/gitserver-core/src/protocol_v2.rs+15 −9
⋯ 3 unchanged lines
44 //
55 // Copyright (c) 2026 WJQSERVER
66
7-use std::collections::BTreeSet;
8-use std::collections::HashSet;
9-use std::io::Cursor;
10-use std::path::Path;
7+use std::{
8+ collections::{
9+ BTreeSet,
10+ HashSet,
11+ },
12+ io::Cursor,
13+ path::Path,
14+};
1115
12-use crate::error::{
13- Error,
14- Result,
16+use crate::{
17+ error::{
18+ Error,
19+ Result,
20+ },
21+ pack::UploadPackRequest,
22+ pktline,
1523 };
16-use crate::pack::UploadPackRequest;
17-use crate::pktline;
1824
1925 const CAPABILITIES: &[&str] = &[
2026 "ls-refs=unborn",
⋯ 732 unchanged lines
modifiedvendor/gitserver-core/src/receive_pack.rs+28 −20
⋯ 3 unchanged lines
44 //
55 // Copyright (c) 2026 WJQSERVER
66
7-use std::io::{
8- BufRead,
9- BufReader,
10- Read,
7+use std::{
8+ io::{
9+ BufRead,
10+ BufReader,
11+ Read,
12+ },
13+ path::Path,
14+ sync::atomic::AtomicBool,
1115 };
12-use std::path::Path;
13-use std::sync::atomic::AtomicBool;
1416
15-use gix::objs::bstr::BString;
16-use gix::prelude::ObjectIdExt;
17-use gix::progress::Discard;
18-use gix::refs::Target;
19-use gix::refs::transaction::{
20- Change,
21- LogChange,
22- PreviousValue,
23- RefEdit,
24- RefLog,
17+use gix::{
18+ objs::bstr::BString,
19+ prelude::ObjectIdExt,
20+ progress::Discard,
21+ refs::{
22+ Target,
23+ transaction::{
24+ Change,
25+ LogChange,
26+ PreviousValue,
27+ RefEdit,
28+ RefLog,
29+ },
30+ },
2531 };
2632
27-use crate::error::{
28- Error,
29- Result,
33+use crate::{
34+ error::{
35+ Error,
36+ Result,
37+ },
38+ pktline,
3039 };
31-use crate::pktline;
3240
3341 const ZERO_ID: &str = "0000000000000000000000000000000000000000";
3442 const CAPABILITIES: &str = concat!(
⋯ 641 unchanged lines
modifiedvendor/gitserver-core/src/refs.rs+10 −6
11 use std::path::Path;
22
3-use crate::error::Result;
4-use crate::pktline;
3+use crate::{
4+ error::Result,
5+ pktline,
6+};
57
68 const CAPABILITIES: &str = "multi_ack multi_ack_detailed side-band-64k ofs-delta";
79
⋯ 66 unchanged lines
7476
7577 #[cfg(test)]
7678 mod tests {
77- use std::path::{
78- Path,
79- PathBuf,
79+ use std::{
80+ path::{
81+ Path,
82+ PathBuf,
83+ },
84+ process::Command,
8085 };
81- use std::process::Command;
8286
8387 use tempfile::TempDir;
8488
⋯ 139 unchanged lines