collin/anvil · 0bfd5861
chore: sort derive attributes with cargo-sort-derives
Collin Richards · 2026-06-10 08:23 UTC · 0bfd5861c1b2ec0baf9b4e20b9e5702837251ac0 · parent 89e731e4 · browse files
modified.githooks/pre-commit+9 −1
| 1 | 1 | #!/bin/sh | |
| 2 | - | # Pre-commit: rustfmt (nightly, for the unstable options in rustfmt.toml) + clippy. | |
| 2 | + | # Pre-commit: rustfmt (nightly, for the unstable options in rustfmt.toml), | |
| 3 | + | # cargo-sort-derives, and clippy. | |
| 3 | 4 | # Wired up via `git config core.hooksPath .githooks`. | |
| 4 | 5 | set -e | |
| 5 | 6 | ||
| ⋯ 4 unchanged lines | |||
| 10 | 11 | exit 1 | |
| 11 | 12 | fi | |
| 12 | 13 | ||
| 14 | + | if ! cargo sort-derives --check >/dev/null 2>&1; then | |
| 15 | + | cargo sort-derives | |
| 16 | + | echo "pre-commit: cargo sort-derives reordered derives — review, re-stage, and commit again." >&2 | |
| 17 | + | git diff --name-only -- '*.rs' >&2 | |
| 18 | + | exit 1 | |
| 19 | + | fi | |
| 20 | + | ||
| 13 | 21 | cargo clippy --workspace --all-targets -- -D warnings | |
modifiedCLAUDE.md+2 −1
| ⋯ 2 unchanged lines | |||
| 3 | 3 | A minimal, self-hosted git forge in Rust, built on gix (gitoxide). | |
| 4 | 4 | ||
| 5 | 5 | Dev setup: `git config core.hooksPath .githooks` — the pre-commit hook runs | |
| 6 | - | `cargo +nightly fmt` (nightly, for the unstable options in rustfmt.toml) and | |
| 6 | + | `cargo +nightly fmt` (nightly, for the unstable options in rustfmt.toml), | |
| 7 | + | `cargo sort-derives` (`cargo install cargo-sort-derives`), and | |
| 7 | 8 | `cargo clippy --workspace --all-targets -- -D warnings`. | |
| 8 | 9 | ||
| 9 | 10 | Current status, resume notes, the agreed next steps (a/b/c), and the roadmap live | |
| ⋯ 3 unchanged lines | |||
modifiedcrates/anvil-core/src/ci.rs+2 −2
| ⋯ 21 unchanged lines | |||
| 22 | 22 | pub const PIPELINE_PATH: &str = ".anvil/ci.yml"; | |
| 23 | 23 | ||
| 24 | 24 | /// A parsed pipeline: a base image and ordered straight-line steps. | |
| 25 | - | #[derive(Debug, Clone, Deserialize)] | |
| 25 | + | #[derive(Clone, Debug, Deserialize)] | |
| 26 | 26 | pub struct Pipeline { | |
| 27 | 27 | /// Docker image the steps run in, e.g. `rust:1.95-bookworm`. | |
| 28 | 28 | pub image: String, | |
| ⋯ 2 unchanged lines | |||
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | 33 | /// One pipeline step: a shell command, with an optional display name. | |
| 34 | - | #[derive(Debug, Clone, Deserialize)] | |
| 34 | + | #[derive(Clone, Debug, Deserialize)] | |
| 35 | 35 | pub struct Step { | |
| 36 | 36 | #[serde(default)] | |
| 37 | 37 | pub name: String, | |
| ⋯ 205 unchanged lines | |||
modifiedcrates/anvil-core/src/config.rs+4 −4
| ⋯ 17 unchanged lines | |||
| 18 | 18 | /// Top-level anvil configuration. | |
| 19 | 19 | /// | |
| 20 | 20 | /// Load with [`Config::load`] (from a TOML file) or [`Config::default`]. | |
| 21 | - | #[derive(Debug, Clone, Serialize, Deserialize)] | |
| 21 | + | #[derive(Clone, Debug, Deserialize, Serialize)] | |
| 22 | 22 | #[serde(default)] | |
| 23 | 23 | pub struct Config { | |
| 24 | 24 | /// Root directory holding all server state (database + repositories). | |
| ⋯ 13 unchanged lines | |||
| 38 | 38 | /// POSTs to [`deploy_webhook`](CiConfig::deploy_webhook). This is deliberately | |
| 39 | 39 | /// scoped to **one** repository — no other repo can trigger the deploy, even | |
| 40 | 40 | /// with its own passing CI. | |
| 41 | - | #[derive(Debug, Clone, Serialize, Deserialize)] | |
| 41 | + | #[derive(Clone, Debug, Deserialize, Serialize)] | |
| 42 | 42 | #[serde(default)] | |
| 43 | 43 | pub struct CiConfig { | |
| 44 | 44 | /// The one repository (`owner/name`) permitted to trigger the deploy | |
| ⋯ 35 unchanged lines | |||
| 80 | 80 | pub run_as: String, | |
| 81 | 81 | } | |
| 82 | 82 | ||
| 83 | - | #[derive(Debug, Clone, Serialize, Deserialize)] | |
| 83 | + | #[derive(Clone, Debug, Deserialize, Serialize)] | |
| 84 | 84 | #[serde(default)] | |
| 85 | 85 | pub struct HttpConfig { | |
| 86 | 86 | /// Address the HTTP server binds to, e.g. `127.0.0.1:3000`. | |
| ⋯ 8 unchanged lines | |||
| 95 | 95 | pub highlight_cache_mb: usize, | |
| 96 | 96 | } | |
| 97 | 97 | ||
| 98 | - | #[derive(Debug, Clone, Serialize, Deserialize)] | |
| 98 | + | #[derive(Clone, Debug, Deserialize, Serialize)] | |
| 99 | 99 | #[serde(default)] | |
| 100 | 100 | pub struct SshConfig { | |
| 101 | 101 | /// Whether the SSH git transport is enabled. | |
| ⋯ 178 unchanged lines | |||
modifiedcrates/anvil-core/src/models.rs+1 −1
| ⋯ 41 unchanged lines | |||
| 42 | 42 | /// `status` is one of `queued`, `running`, `success`, `failure` (a step exited | |
| 43 | 43 | /// non-zero), or `error` (the runner itself failed). `started_at`/`finished_at` | |
| 44 | 44 | /// are 0 until they occur. | |
| 45 | - | #[derive(Debug, Clone, toasty::Model)] | |
| 45 | + | #[derive(Clone, Debug, toasty::Model)] | |
| 46 | 46 | pub struct CiRun { | |
| 47 | 47 | #[key] | |
| 48 | 48 | #[auto] | |
| ⋯ 43 unchanged lines | |||
modifiedcrates/anvil-git/src/browse.rs+1 −1
| ⋯ 117 unchanged lines | |||
| 118 | 118 | } | |
| 119 | 119 | ||
| 120 | 120 | /// How a file changed between two commits. | |
| 121 | - | #[derive(Clone, Copy, PartialEq, Eq)] | |
| 121 | + | #[derive(Clone, Copy, Eq, PartialEq)] | |
| 122 | 122 | pub enum ChangeKind { | |
| 123 | 123 | Added, | |
| 124 | 124 | Deleted, | |
| ⋯ 380 unchanged lines | |||
modifiedcrates/anvil-git/src/smart_http.rs+1 −1
| ⋯ 23 unchanged lines | |||
| 24 | 24 | use crate::error::Result; | |
| 25 | 25 | ||
| 26 | 26 | /// The two git wire services. | |
| 27 | - | #[derive(Debug, Copy, Clone, Eq, PartialEq)] | |
| 27 | + | #[derive(Clone, Copy, Debug, Eq, PartialEq)] | |
| 28 | 28 | pub enum Service { | |
| 29 | 29 | /// `git-upload-pack` — serves fetch/clone. | |
| 30 | 30 | UploadPack, | |
| ⋯ 125 unchanged lines | |||
modifiedvendor/gitserver-core/src/discovery.rs+2 −2
| ⋯ 19 unchanged lines | |||
| 20 | 20 | "Unnamed repository; edit this file 'description' to name the repository."; | |
| 21 | 21 | ||
| 22 | 22 | /// Information about a discovered bare git repository. | |
| 23 | - | #[derive(Debug, Clone, Serialize)] | |
| 23 | + | #[derive(Clone, Debug, Serialize)] | |
| 24 | 24 | pub struct RepoInfo { | |
| 25 | 25 | pub name: String, | |
| 26 | 26 | pub relative_path: String, | |
| ⋯ 4 unchanged lines | |||
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | 33 | /// A store of discovered repositories under a root directory. | |
| 34 | - | #[derive(Debug, Clone)] | |
| 34 | + | #[derive(Clone, Debug)] | |
| 35 | 35 | pub struct RepoStore { | |
| 36 | 36 | root: PathBuf, | |
| 37 | 37 | max_depth: u32, | |
| ⋯ 268 unchanged lines | |||
modifiedvendor/gitserver-core/src/pack.rs+2 −2
| ⋯ 14 unchanged lines | |||
| 15 | 15 | }; | |
| 16 | 16 | use crate::pktline; | |
| 17 | 17 | ||
| 18 | - | #[derive(Debug, Clone, Default)] | |
| 18 | + | #[derive(Clone, Debug, Default)] | |
| 19 | 19 | pub struct UploadPackCapabilities { | |
| 20 | 20 | pub ofs_delta: bool, | |
| 21 | 21 | pub multi_ack: bool, | |
| 22 | 22 | pub multi_ack_detailed: bool, | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | - | #[derive(Debug, Clone, Default)] | |
| 25 | + | #[derive(Clone, Debug, Default)] | |
| 26 | 26 | pub struct ShallowRequest { | |
| 27 | 27 | pub depth: Option<usize>, | |
| 28 | 28 | pub client_shallows: Vec<gix::ObjectId>, | |
| ⋯ 820 unchanged lines | |||