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 | |||
| 6 | 6 | RngCore, | |
| 7 | 7 | }; | |
| 8 | 8 | ||
| 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 | + | }, | |
| 13 | 15 | }; | |
| 14 | 16 | ||
| 15 | 17 | /// Default session lifetime: 30 days. | |
| ⋯ 64 unchanged lines | |||
modifiedcrates/anvil-core/src/ssh_keys.rs+6 −4
| ⋯ 5 unchanged lines | |||
| 6 | 6 | PublicKey, | |
| 7 | 7 | }; | |
| 8 | 8 | ||
| 9 | - | use crate::error::{ | |
| 10 | - | Error, | |
| 11 | - | Result, | |
| 9 | + | use crate::{ | |
| 10 | + | error::{ | |
| 11 | + | Error, | |
| 12 | + | Result, | |
| 13 | + | }, | |
| 14 | + | models::SshKey, | |
| 12 | 15 | }; | |
| 13 | - | use crate::models::SshKey; | |
| 14 | 16 | ||
| 15 | 17 | /// Parse an OpenSSH public-key line (`ssh-ed25519 AAAA… comment`) into its | |
| 16 | 18 | /// canonical SHA256 fingerprint and normalized key line, for registration. | |
| ⋯ 82 unchanged lines | |||
modifiedcrates/anvil-core/src/users.rs+15 −11
| 1 | 1 | //! User accounts: creation, lookup, and password hashing. | |
| 2 | 2 | ||
| 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 | + | }, | |
| 10 | 12 | }; | |
| 11 | 13 | ||
| 12 | - | use crate::error::{ | |
| 13 | - | Error, | |
| 14 | - | Result, | |
| 14 | + | use crate::{ | |
| 15 | + | error::{ | |
| 16 | + | Error, | |
| 17 | + | Result, | |
| 18 | + | }, | |
| 19 | + | models::User, | |
| 15 | 20 | }; | |
| 16 | - | use crate::models::User; | |
| 17 | 21 | ||
| 18 | 22 | /// Usernames reserved for system use — they collide with (or could be confused | |
| 19 | 23 | /// for) top-level routes such as the `/-/…` namespace. | |
| ⋯ 93 unchanged lines | |||
modifiedcrates/anvil-git/src/smart_http.rs+5 −3
| ⋯ 9 unchanged lines | |||
| 10 | 10 | //! for fetch (the modern default) with a v0 fallback, and the classic v0 | |
| 11 | 11 | //! advertisement for `receive-pack` (push). | |
| 12 | 12 | ||
| 13 | - | use std::path::Path; | |
| 14 | - | use std::pin::Pin; | |
| 13 | + | use std::{ | |
| 14 | + | path::Path, | |
| 15 | + | pin::Pin, | |
| 16 | + | }; | |
| 15 | 17 | ||
| 16 | - | use gitserver_core::backend::GitBackend; | |
| 17 | 18 | use gitserver_core::{ | |
| 19 | + | backend::GitBackend, | |
| 18 | 20 | pack, | |
| 19 | 21 | pktline, | |
| 20 | 22 | protocol_v2, | |
| ⋯ 135 unchanged lines | |||
modifiedcrates/anvil-git/src/ssh.rs+7 −5
| ⋯ 18 unchanged lines | |||
| 19 | 19 | AsyncWriteExt, | |
| 20 | 20 | }; | |
| 21 | 21 | ||
| 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 | + | }, | |
| 27 | 29 | }; | |
| 28 | 30 | ||
| 29 | 31 | /// 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 | |||
| 5 | 5 | //! branch tips *before* the push, then call [`enqueue_ci_for_push`] after it | |
| 6 | 6 | //! succeeds. | |
| 7 | 7 | ||
| 8 | - | use std::collections::HashMap; | |
| 9 | - | use std::path::Path; | |
| 8 | + | use std::{ | |
| 9 | + | collections::HashMap, | |
| 10 | + | path::Path, | |
| 11 | + | }; | |
| 10 | 12 | ||
| 11 | 13 | /// Local branch short-name → tip commit id (hex). | |
| 12 | 14 | pub type BranchTips = HashMap<String, String>; | |
| ⋯ 54 unchanged lines | |||
modifiedrustfmt.toml+1 −0
| ⋯ 4 unchanged lines | |||
| 5 | 5 | ||
| 6 | 6 | group_imports = "StdExternalCrate" | |
| 7 | 7 | 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 | + | }, | |
| 11 | 15 | }; | |
| 12 | 16 | ||
| 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 | + | }, | |
| 18 | 24 | }; | |
| 19 | 25 | use tokio_util::io::SyncIoBridge; | |
| 20 | 26 | ||
| 21 | - | use crate::error::Result; | |
| 22 | - | use crate::pack::UploadPackRequest; | |
| 27 | + | use crate::{ | |
| 28 | + | error::Result, | |
| 29 | + | pack::UploadPackRequest, | |
| 30 | + | }; | |
| 23 | 31 | ||
| 24 | 32 | pub const RECEIVE_PACK_TIMEOUT: Duration = Duration::from_secs(300); | |
| 25 | 33 | 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 | + | }, | |
| 5 | 7 | }; | |
| 6 | 8 | ||
| 7 | 9 | use serde::Serialize; | |
| ⋯ 169 unchanged lines | |||
| 177 | 179 | ||
| 178 | 180 | #[cfg(test)] | |
| 179 | 181 | mod tests { | |
| 180 | - | use std::path::Path; | |
| 181 | - | use std::process::Command; | |
| 182 | + | use std::{ | |
| 183 | + | path::Path, | |
| 184 | + | process::Command, | |
| 185 | + | }; | |
| 182 | 186 | ||
| 183 | 187 | use tempfile::TempDir; | |
| 184 | 188 | ||
| ⋯ 121 unchanged lines | |||
modifiedvendor/gitserver-core/src/dynamic_registry.rs+22 −16
| ⋯ 3 unchanged lines | |||
| 4 | 4 | // | |
| 5 | 5 | // Copyright (c) 2026 WJQSERVER | |
| 6 | 6 | ||
| 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 | + | }, | |
| 14 | 16 | }; | |
| 15 | 17 | ||
| 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 | + | }, | |
| 23 | 27 | }; | |
| 24 | 28 | ||
| 25 | 29 | pub trait RepoResolver: Send + Sync { | |
| ⋯ 123 unchanged lines | |||
| 149 | 153 | ||
| 150 | 154 | #[cfg(test)] | |
| 151 | 155 | mod tests { | |
| 152 | - | use std::path::Path; | |
| 153 | - | use std::process::Command; | |
| 156 | + | use std::{ | |
| 157 | + | path::Path, | |
| 158 | + | process::Command, | |
| 159 | + | }; | |
| 154 | 160 | ||
| 155 | 161 | use tempfile::TempDir; | |
| 156 | 162 | ||
| ⋯ 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 | + | }; | |
| 3 | 5 | ||
| 4 | 6 | use bytes::Bytes; | |
| 5 | 7 | use sha1::{ | |
| ⋯ 3 unchanged lines | |||
| 9 | 11 | use tokio::io::AsyncRead; | |
| 10 | 12 | use tokio_util::io::StreamReader; | |
| 11 | 13 | ||
| 12 | - | use crate::error::{ | |
| 13 | - | Error, | |
| 14 | - | Result, | |
| 14 | + | use crate::{ | |
| 15 | + | error::{ | |
| 16 | + | Error, | |
| 17 | + | Result, | |
| 18 | + | }, | |
| 19 | + | pktline, | |
| 15 | 20 | }; | |
| 16 | - | use crate::pktline; | |
| 17 | 21 | ||
| 18 | 22 | #[derive(Clone, Debug, Default)] | |
| 19 | 23 | pub struct UploadPackCapabilities { | |
| ⋯ 636 unchanged lines | |||
| 656 | 660 | ||
| 657 | 661 | #[cfg(test)] | |
| 658 | 662 | mod tests { | |
| 659 | - | use std::path::{ | |
| 660 | - | Path, | |
| 661 | - | PathBuf, | |
| 663 | + | use std::{ | |
| 664 | + | path::{ | |
| 665 | + | Path, | |
| 666 | + | PathBuf, | |
| 667 | + | }, | |
| 668 | + | process::Command, | |
| 662 | 669 | }; | |
| 663 | - | use std::process::Command; | |
| 664 | 670 | ||
| 665 | 671 | use tempfile::TempDir; | |
| 666 | 672 | use tokio::io::AsyncReadExt; | |
| ⋯ 182 unchanged lines | |||
modifiedvendor/gitserver-core/src/protocol_v2.rs+15 −9
| ⋯ 3 unchanged lines | |||
| 4 | 4 | // | |
| 5 | 5 | // Copyright (c) 2026 WJQSERVER | |
| 6 | 6 | ||
| 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 | + | }; | |
| 11 | 15 | ||
| 12 | - | use crate::error::{ | |
| 13 | - | Error, | |
| 14 | - | Result, | |
| 16 | + | use crate::{ | |
| 17 | + | error::{ | |
| 18 | + | Error, | |
| 19 | + | Result, | |
| 20 | + | }, | |
| 21 | + | pack::UploadPackRequest, | |
| 22 | + | pktline, | |
| 15 | 23 | }; | |
| 16 | - | use crate::pack::UploadPackRequest; | |
| 17 | - | use crate::pktline; | |
| 18 | 24 | ||
| 19 | 25 | const CAPABILITIES: &[&str] = &[ | |
| 20 | 26 | "ls-refs=unborn", | |
| ⋯ 732 unchanged lines | |||
modifiedvendor/gitserver-core/src/receive_pack.rs+28 −20
| ⋯ 3 unchanged lines | |||
| 4 | 4 | // | |
| 5 | 5 | // Copyright (c) 2026 WJQSERVER | |
| 6 | 6 | ||
| 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, | |
| 11 | 15 | }; | |
| 12 | - | use std::path::Path; | |
| 13 | - | use std::sync::atomic::AtomicBool; | |
| 14 | 16 | ||
| 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 | + | }, | |
| 25 | 31 | }; | |
| 26 | 32 | ||
| 27 | - | use crate::error::{ | |
| 28 | - | Error, | |
| 29 | - | Result, | |
| 33 | + | use crate::{ | |
| 34 | + | error::{ | |
| 35 | + | Error, | |
| 36 | + | Result, | |
| 37 | + | }, | |
| 38 | + | pktline, | |
| 30 | 39 | }; | |
| 31 | - | use crate::pktline; | |
| 32 | 40 | ||
| 33 | 41 | const ZERO_ID: &str = "0000000000000000000000000000000000000000"; | |
| 34 | 42 | const CAPABILITIES: &str = concat!( | |
| ⋯ 641 unchanged lines | |||
modifiedvendor/gitserver-core/src/refs.rs+10 −6
| 1 | 1 | use std::path::Path; | |
| 2 | 2 | ||
| 3 | - | use crate::error::Result; | |
| 4 | - | use crate::pktline; | |
| 3 | + | use crate::{ | |
| 4 | + | error::Result, | |
| 5 | + | pktline, | |
| 6 | + | }; | |
| 5 | 7 | ||
| 6 | 8 | const CAPABILITIES: &str = "multi_ack multi_ack_detailed side-band-64k ofs-delta"; | |
| 7 | 9 | ||
| ⋯ 66 unchanged lines | |||
| 74 | 76 | ||
| 75 | 77 | #[cfg(test)] | |
| 76 | 78 | mod tests { | |
| 77 | - | use std::path::{ | |
| 78 | - | Path, | |
| 79 | - | PathBuf, | |
| 79 | + | use std::{ | |
| 80 | + | path::{ | |
| 81 | + | Path, | |
| 82 | + | PathBuf, | |
| 83 | + | }, | |
| 84 | + | process::Command, | |
| 80 | 85 | }; | |
| 81 | - | use std::process::Command; | |
| 82 | 86 | ||
| 83 | 87 | use tempfile::TempDir; | |
| 84 | 88 | ||
| ⋯ 139 unchanged lines | |||