anvilsign in

collin/anvil · 2b7e7397

style: collapse multiline imports via rustfmt

Collin Richards · 2026-06-09 21:51 UTC · 2b7e739752efa97343ac757a425632d15204c80a · parent 7f97cf80 · browse files

modifiedcrates/anvil-core/src/access.rs+1 −4
⋯ 3 unchanged lines
44 //! a repo is owned by one user; private repos are visible only to their owner;
55 //! writes (push) and settings changes are owner-only. Admins may do anything.
66
7-use crate::models::{
8- Repository,
9- User,
10-};
7+use crate::models::{Repository, User};
118
129 /// Whether `viewer` may read (browse / clone) `repo`.
1310 pub fn can_read(repo: &Repository, viewer: Option<&User>) -> bool {
⋯ 10 unchanged lines
modifiedcrates/anvil-core/src/db.rs+1 −7
⋯ 2 unchanged lines
33 use std::path::Path;
44
55 use crate::error::Result;
6-use crate::models::{
7- CiRun,
8- Repository,
9- Session,
10- SshKey,
11- User,
12-};
6+use crate::models::{CiRun, Repository, Session, SshKey, User};
137
148 /// Open (creating if necessary) the SQLite database at `path`, creating the
159 /// schema on first run.
⋯ 22 unchanged lines
modifiedcrates/anvil-core/src/repos.rs+2 −8
⋯ 1 unchanged line
22
33 use std::path::Path;
44
5-use crate::error::{
6- Error,
7- Result,
8-};
9-use crate::models::{
10- Repository,
11- User,
12-};
5+use crate::error::{Error, Result};
6+use crate::models::{Repository, User};
137 use crate::storage;
148
159 /// A repository joined with its owner's username, for listing pages.
⋯ 141 unchanged lines
modifiedcrates/anvil-core/src/sessions.rs+2 −8
11 //! Web login sessions: opaque random tokens stored server-side and referenced
22 //! by a cookie.
33
4-use argon2::password_hash::rand_core::{
5- OsRng,
6- RngCore,
7-};
4+use argon2::password_hash::rand_core::{OsRng, RngCore};
85
96 use crate::error::Result;
10-use crate::models::{
11- Session,
12- User,
13-};
7+use crate::models::{Session, User};
148
159 /// Default session lifetime: 30 days.
1610 const SESSION_TTL_SECS: i64 = 60 * 60 * 24 * 30;
⋯ 63 unchanged lines
modifiedcrates/anvil-core/src/ssh_keys.rs+2 −8
11 //! SSH public keys: parsing, registration, and lookup for git-over-SSH
22 //! authentication.
33
4-use ssh_key::{
5- HashAlg,
6- PublicKey,
7-};
4+use ssh_key::{HashAlg, PublicKey};
85
9-use crate::error::{
10- Error,
11- Result,
12-};
6+use crate::error::{Error, Result};
137 use crate::models::SshKey;
148
159 /// Parse an OpenSSH public-key line (`ssh-ed25519 AAAA… comment`) into its
⋯ 83 unchanged lines
modifiedcrates/anvil-core/src/storage.rs+3 −14
⋯ 4 unchanged lines
55 //! between forge identities and filesystem paths, plus creation/opening via
66 //! `gix`. No database access happens here.
77
8-use std::path::{
9- Path,
10- PathBuf,
11-};
8+use std::path::{Path, PathBuf};
129
13-use crate::error::{
14- Error,
15- Result,
16-};
10+use crate::error::{Error, Result};
1711
1812 /// Compute the on-disk path of a bare repository.
1913 pub fn repo_path(repositories_dir: &Path, owner: &str, name: &str) -> PathBuf {
⋯ 33 unchanged lines
5347 /// Point `HEAD` at `refs/heads/<branch>` as a symbolic reference.
5448 fn set_head_branch(repo: &gix::Repository, branch: &str) -> Result<()> {
5549 use gix::refs::Target;
56- use gix::refs::transaction::{
57- Change,
58- LogChange,
59- PreviousValue,
60- RefEdit,
61- };
50+ use gix::refs::transaction::{Change, LogChange, PreviousValue, RefEdit};
6251
6352 let target_name: gix::refs::FullName = format!("refs/heads/{branch}")
6453 .try_into()
⋯ 23 unchanged lines
modifiedcrates/anvil-core/src/users.rs+2 −10
⋯ 1 unchanged line
22
33 use argon2::Argon2;
44 use argon2::password_hash::rand_core::OsRng;
5-use argon2::password_hash::{
6- PasswordHash,
7- PasswordHasher,
8- PasswordVerifier,
9- SaltString,
10-};
5+use argon2::password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString};
116
12-use crate::error::{
13- Error,
14- Result,
15-};
7+use crate::error::{Error, Result};
168 use crate::models::User;
179
1810 /// Usernames reserved for system use — they collide with (or could be confused
⋯ 94 unchanged lines
modifiedcrates/anvil-git/src/lib.rs+2 −8
⋯ 18 unchanged lines
1919 pub mod ssh;
2020 pub mod trigger;
2121
22-pub use error::{
23- Error,
24- Result,
25-};
26-pub use smart_http::{
27- Service,
28- UploadPack,
29-};
22+pub use error::{Error, Result};
23+pub use smart_http::{Service, UploadPack};
modifiedcrates/anvil-git/src/smart_http.rs+1 −5
⋯ 13 unchanged lines
1414 use std::pin::Pin;
1515
1616 use gitserver_core::backend::GitBackend;
17-use gitserver_core::{
18- pack,
19- pktline,
20- protocol_v2,
21-};
17+use gitserver_core::{pack, pktline, protocol_v2};
2218 use tokio::io::AsyncRead;
2319
2420 use crate::error::Result;
⋯ 131 unchanged lines
modifiedcrates/anvil-git/src/ssh.rs+2 −11
⋯ 11 unchanged lines
1212 use std::path::Path;
1313
1414 use gitserver_core::backend::GitBackend;
15-use tokio::io::{
16- AsyncRead,
17- AsyncReadExt,
18- AsyncWrite,
19- AsyncWriteExt,
20-};
15+use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
2116
2217 use crate::error::Result;
23-use crate::smart_http::{
24- self,
25- Service,
26- UploadPack,
27-};
18+use crate::smart_http::{self, Service, UploadPack};
2819
2920 /// Parse an SSH `exec` command such as `git-upload-pack '/alice/hello.git'`,
3021 /// returning the service and the (leading-slash-trimmed) repository path.
⋯ 198 unchanged lines
modifiedvendor/gitserver-core/src/backend.rs+3 −13
11 use std::path::PathBuf;
22 use std::pin::Pin;
33 use std::sync::Arc;
4-use std::sync::atomic::{
5- AtomicBool,
6- Ordering,
7-};
8-use std::task::{
9- Context,
10- Poll,
11-};
4+use std::sync::atomic::{AtomicBool, Ordering};
5+use std::task::{Context, Poll};
126
137 use tokio::io::AsyncRead;
14-use tokio::time::{
15- Duration,
16- Sleep,
17- sleep,
18-};
8+use tokio::time::{Duration, Sleep, sleep};
199 use tokio_util::io::SyncIoBridge;
2010
2111 use crate::error::Result;
⋯ 230 unchanged lines
modifiedvendor/gitserver-core/src/discovery.rs+3 −13
11 use std::fs;
2-use std::path::{
3- Path,
4- PathBuf,
5-};
2+use std::path::{Path, PathBuf};
63
74 use serde::Serialize;
85
9-pub use crate::dynamic_registry::{
10- DynamicRepoRegistry,
11- MutableRepoRegistry,
12- RepoResolver,
13-};
14-use crate::error::{
15- Error,
16- Result,
17-};
6+pub use crate::dynamic_registry::{DynamicRepoRegistry, MutableRepoRegistry, RepoResolver};
7+use crate::error::{Error, Result};
188
199 const DEFAULT_GIT_DESCRIPTION: &str =
2010 "Unnamed repository; edit this file 'description' to name the repository.";
⋯ 285 unchanged lines
modifiedvendor/gitserver-core/src/dynamic_registry.rs+4 −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,
14-};
7+use std::path::{Path, PathBuf};
8+use std::sync::{Arc, RwLock};
159
16-use crate::discovery::{
17- RepoInfo,
18- RepoStore,
19-};
20-use crate::error::{
21- Error,
22- Result,
23-};
10+use crate::discovery::{RepoInfo, RepoStore};
11+use crate::error::{Error, Result};
2412
2513 pub trait RepoResolver: Send + Sync {
2614 fn resolve(&self, relative: &str) -> Result<RepoInfo>;
⋯ 249 unchanged lines
modifiedvendor/gitserver-core/src/pack.rs+3 −12
⋯ 1 unchanged line
22 use std::path::Path;
33
44 use bytes::Bytes;
5-use sha1::{
6- Digest,
7- Sha1,
8-};
5+use sha1::{Digest, Sha1};
96 use tokio::io::AsyncRead;
107 use tokio_util::io::StreamReader;
118
12-use crate::error::{
13- Error,
14- Result,
15-};
9+use crate::error::{Error, Result};
1610 use crate::pktline;
1711
1812 #[derive(Debug, Clone, Default)]
⋯ 637 unchanged lines
656650
657651 #[cfg(test)]
658652 mod tests {
659- use std::path::{
660- Path,
661- PathBuf,
662- };
653+ use std::path::{Path, PathBuf};
663654 use std::process::Command;
664655
665656 use tempfile::TempDir;
⋯ 183 unchanged lines
modifiedvendor/gitserver-core/src/path.rs+2 −9
1-use std::path::{
2- Component,
3- Path,
4- PathBuf,
5-};
1+use std::path::{Component, Path, PathBuf};
62
7-use crate::error::{
8- Error,
9- Result,
10-};
3+use crate::error::{Error, Result};
114
125 /// Normalize a path by resolving `.` and `..` components lexically,
136 /// without touching the filesystem.
⋯ 90 unchanged lines
modifiedvendor/gitserver-core/src/protocol_v2.rs+2 −8
⋯ 8 unchanged lines
99 use std::io::Cursor;
1010 use std::path::Path;
1111
12-use crate::error::{
13- Error,
14- Result,
15-};
12+use crate::error::{Error, Result};
1613 use crate::pack::UploadPackRequest;
1714 use crate::pktline;
1815
⋯ 566 unchanged lines
585582 request: &crate::pack::UploadPackRequest,
586583 depth: usize,
587584 ) -> Result<DepthState> {
588- use std::collections::{
589- HashSet,
590- VecDeque,
591- };
585+ use std::collections::{HashSet, VecDeque};
592586
593587 let mut queue = VecDeque::new();
594588 let mut seen = HashSet::new();
⋯ 158 unchanged lines
modifiedvendor/gitserver-core/src/receive_pack.rs+3 −16
⋯ 3 unchanged lines
44 //
55 // Copyright (c) 2026 WJQSERVER
66
7-use std::io::{
8- BufRead,
9- BufReader,
10- Read,
11-};
7+use std::io::{BufRead, BufReader, Read};
128 use std::path::Path;
139 use std::sync::atomic::AtomicBool;
1410
⋯ 1 unchanged line
1612 use gix::prelude::ObjectIdExt;
1713 use gix::progress::Discard;
1814 use gix::refs::Target;
19-use gix::refs::transaction::{
20- Change,
21- LogChange,
22- PreviousValue,
23- RefEdit,
24- RefLog,
25-};
15+use gix::refs::transaction::{Change, LogChange, PreviousValue, RefEdit, RefLog};
2616
27-use crate::error::{
28- Error,
29- Result,
30-};
17+use crate::error::{Error, Result};
3118 use crate::pktline;
3219
3320 const ZERO_ID: &str = "0000000000000000000000000000000000000000";
⋯ 529 unchanged lines
modifiedvendor/gitserver-core/src/refs.rs+1 −4
⋯ 73 unchanged lines
7474
7575 #[cfg(test)]
7676 mod tests {
77- use std::path::{
78- Path,
79- PathBuf,
80- };
77+ use std::path::{Path, PathBuf};
8178 use std::process::Command;
8279
8380 use tempfile::TempDir;
⋯ 140 unchanged lines