Commit

Author:

Hash:

Timestamp:

+115 -90 +/-19 browse

Kevin Schoon [me@kevinschoon.com]

776ff7ebc8baf543c3cffeb85cff83fec45e84ea

Tue, 11 Nov 2025 12:29:46 +0000 (3 weeks ago)

run cargo fmt
1diff --git a/ayllu-build/src/config.rs b/ayllu-build/src/config.rs
2index 8fbdccd..dd78aea 100644
3--- a/ayllu-build/src/config.rs
4+++ b/ayllu-build/src/config.rs
5 @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
6
7 use serde::{Deserialize, Serialize};
8
9- use ayllu_config::{data_dir, runtime_dir, Configurable, Database, Error, Reader};
10+ use ayllu_config::{Configurable, Database, Error, Reader, data_dir, runtime_dir};
11
12 #[derive(Deserialize, Serialize, Clone, Debug)]
13 pub struct Builder {
14 diff --git a/ayllu-build/src/evaluate.rs b/ayllu-build/src/evaluate.rs
15index 42ebd9c..cb21c0c 100644
16--- a/ayllu-build/src/evaluate.rs
17+++ b/ayllu-build/src/evaluate.rs
18 @@ -10,16 +10,16 @@ use petgraph::{
19 };
20
21 use crate::{
22- error::Error,
23- executor::{Context, Executor, Local},
24+ DEFAULT_BUILD_FILE,
25+ models::{Manifest, Step},
26 };
27 use crate::{
28- models::{Manifest, Step},
29- DEFAULT_BUILD_FILE,
30+ error::Error,
31+ executor::{Context, Executor, Local},
32 };
33 use ayllu_database::{
34- build::{BuildExt, BuildTx},
35 Tx, Wrapper as Database,
36+ build::{BuildExt, BuildTx},
37 };
38
39 use ayllu_api::build::Unit;
40 diff --git a/ayllu-build/src/executor.rs b/ayllu-build/src/executor.rs
41index f5c3319..2609182 100644
42--- a/ayllu-build/src/executor.rs
43+++ b/ayllu-build/src/executor.rs
44 @@ -1,6 +1,6 @@
45 use std::collections::HashMap;
46 use std::env;
47- use std::fs::{read_to_string, File};
48+ use std::fs::{File, read_to_string};
49 use std::mem::take;
50 use std::path::{Path, PathBuf};
51 use std::process::{Command, ExitStatus, Stdio};
52 @@ -50,7 +50,7 @@ pub struct Context {
53 // the only executor that exists is the Local exector.
54 pub trait Executor {
55 fn execute(&self, step: &Step, context: Context)
56- -> Result<(String, String, ExitStatus), Error>;
57+ -> Result<(String, String, ExitStatus), Error>;
58 }
59
60 // build executor that runs with the same permissions as the build server.
61 diff --git a/ayllu-keys/src/main.rs b/ayllu-keys/src/main.rs
62index c0afb0a..7b16ffb 100644
63--- a/ayllu-keys/src/main.rs
64+++ b/ayllu-keys/src/main.rs
65 @@ -108,11 +108,13 @@ mod test {
66 profiles: Vec::new(),
67 }],
68 };
69- assert!(identify(
70- &cfg,
71- "ssh-ed25519",
72- "AAAAC3NzaC1lZDI1NTE5AAAAIDk35l66zSsC9hgnL5T5svFHLauTZNZ595ihvfBGj81+"
73- )
74- .is_some_and(|identity| { identity.username == "hello" }));
75+ assert!(
76+ identify(
77+ &cfg,
78+ "ssh-ed25519",
79+ "AAAAC3NzaC1lZDI1NTE5AAAAIDk35l66zSsC9hgnL5T5svFHLauTZNZ595ihvfBGj81+"
80+ )
81+ .is_some_and(|identity| { identity.username == "hello" })
82+ );
83 }
84 }
85 diff --git a/ayllu-shell/src/ui.rs b/ayllu-shell/src/ui.rs
86index 7a9fa74..654b61c 100644
87--- a/ayllu-shell/src/ui.rs
88+++ b/ayllu-shell/src/ui.rs
89 @@ -5,7 +5,7 @@ use std::{
90
91 use ayllu_git::{Scanner, Sites, Wrapper};
92 use ayllu_identity::Identity;
93- use dialoguer::{theme::ColorfulTheme, Confirm, Input, MultiSelect, Select};
94+ use dialoguer::{Confirm, Input, MultiSelect, Select, theme::ColorfulTheme};
95
96 use crate::{
97 config::{Collection, Config},
98 diff --git a/ayllu/src/languages.rs b/ayllu/src/languages.rs
99index 9c386b0..035b8a6 100644
100--- a/ayllu/src/languages.rs
101+++ b/ayllu/src/languages.rs
102 @@ -175,7 +175,7 @@ impl Languages {
103 loop {
104 match split.next() {
105 Some("-S") | Some("--split-line") => {
106- return split.next().map(|arg| Hint(arg.to_string()))
107+ return split.next().map(|arg| Hint(arg.to_string()));
108 }
109 Some(_) => {} // some other arg
110 None => return None,
111 @@ -395,26 +395,36 @@ print('Hello World\n');
112 color: Some("#FFFFFF".to_string()),
113 filenames: Some(vec![".fuuscript".to_string()]),
114 }]);
115- assert!(table
116- .guess("", None, Some("main.fuu"))
117- .is_some_and(|hint| hint == Hint("FuuBar".to_string())));
118- assert!(table
119- .guess("", None, Some(".fuuscript"))
120- .is_some_and(|hint| hint == Hint("FuuBar".to_string())))
121+ assert!(
122+ table
123+ .guess("", None, Some("main.fuu"))
124+ .is_some_and(|hint| hint == Hint("FuuBar".to_string()))
125+ );
126+ assert!(
127+ table
128+ .guess("", None, Some(".fuuscript"))
129+ .is_some_and(|hint| hint == Hint("FuuBar".to_string()))
130+ )
131 }
132
133 #[test]
134 fn test_filename() {
135 let table = Languages::new();
136- assert!(table
137- .guess("", None, Some(".zshrc"))
138- .is_some_and(|hint| hint == Hint("Shell".to_string())));
139- assert!(table
140- .guess("", None, Some(".profile"))
141- .is_some_and(|hint| hint == Hint("Shell".to_string())));
142- assert!(table
143- .guess("", None, Some("PKGBUILD"))
144- .is_some_and(|hint| hint == Hint("Shell".to_string())));
145+ assert!(
146+ table
147+ .guess("", None, Some(".zshrc"))
148+ .is_some_and(|hint| hint == Hint("Shell".to_string()))
149+ );
150+ assert!(
151+ table
152+ .guess("", None, Some(".profile"))
153+ .is_some_and(|hint| hint == Hint("Shell".to_string()))
154+ );
155+ assert!(
156+ table
157+ .guess("", None, Some("PKGBUILD"))
158+ .is_some_and(|hint| hint == Hint("Shell".to_string()))
159+ );
160 }
161
162 #[test]
163 diff --git a/ayllu/src/main.rs b/ayllu/src/main.rs
164index af8914b..f527f82 100644
165--- a/ayllu/src/main.rs
166+++ b/ayllu/src/main.rs
167 @@ -37,14 +37,15 @@ async fn main() -> Result<(), Box<dyn Error>> {
168 let mut cfg: config::Config = Reader::load(cli.config.as_deref())?;
169 if cfg.collections.is_empty()
170 && let Ok(path) = std::env::current_dir()
171- && ayllu_git::git_dir(path.as_path()).is_ok_and(|is_git_dir| is_git_dir) {
172- cfg.collections.push(Collection {
173- name: String::from("Default"),
174- description: Some(format!("Collection @ {}", path.to_string_lossy())),
175- path,
176- ..Default::default()
177- })
178- }
179+ && ayllu_git::git_dir(path.as_path()).is_ok_and(|is_git_dir| is_git_dir)
180+ {
181+ cfg.collections.push(Collection {
182+ name: String::from("Default"),
183+ description: Some(format!("Collection @ {}", path.to_string_lossy())),
184+ path,
185+ ..Default::default()
186+ })
187+ }
188 init_logger(
189 cli.level
190 .as_ref()
191 diff --git a/ayllu/src/web2/dag.rs b/ayllu/src/web2/dag.rs
192index 4cd7783..efdc0a6 100644
193--- a/ayllu/src/web2/dag.rs
194+++ b/ayllu/src/web2/dag.rs
195 @@ -2,7 +2,7 @@ use std::collections::HashMap;
196
197 use ayllu_api::build::Unit;
198 use ayllu_database::build::{ManifestView, Step, Workflow};
199- use petgraph::{dot, Graph};
200+ use petgraph::{Graph, dot};
201
202 #[derive(Debug)]
203 enum MappedUnit<'a> {
204 diff --git a/ayllu/src/web2/middleware/sites.rs b/ayllu/src/web2/middleware/sites.rs
205index 2d98e4e..42e921a 100644
206--- a/ayllu/src/web2/middleware/sites.rs
207+++ b/ayllu/src/web2/middleware/sites.rs
208 @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
209 use axum::{
210 body::Body,
211 extract,
212- http::{header, StatusCode},
213+ http::{StatusCode, header},
214 middleware::Next,
215 response::{IntoResponse, Response},
216 };
217 @@ -74,12 +74,13 @@ pub async fn middleware(
218 for (other_repo_path, (key, value)) in sites {
219 tracing::debug!("checking site {other_repo_path} {key}={value}");
220 if let Some(header_value) = headers.get(key.as_str())
221- && header_value.to_str().unwrap() == value {
222- tracing::debug!("sites header match: {key}={value}");
223- repo_path = Some(other_repo_path.to_string());
224- break;
225- // return self.serve(req, repo_path).await;
226- };
227+ && header_value.to_str().unwrap() == value
228+ {
229+ tracing::debug!("sites header match: {key}={value}");
230+ repo_path = Some(other_repo_path.to_string());
231+ break;
232+ // return self.serve(req, repo_path).await;
233+ };
234 }
235
236 match repo_path {
237 diff --git a/ayllu/src/web2/routes/finger.rs b/ayllu/src/web2/routes/finger.rs
238index 899c917..83a612e 100644
239--- a/ayllu/src/web2/routes/finger.rs
240+++ b/ayllu/src/web2/routes/finger.rs
241 @@ -10,7 +10,7 @@ use crate::{
242 config::{Collection, Config},
243 web2::error::Error,
244 };
245- use ayllu_git::{name, Error as GitError, Wrapper as Repository};
246+ use ayllu_git::{Error as GitError, Wrapper as Repository, name};
247
248 const AVATAR: &str = "http://webfinger.net/rel/avatar";
249 const PROFILE_PAGE: &str = "http://webfinger.net/rel/profile-page";
250 diff --git a/ayllu/src/web2/routes/git.rs b/ayllu/src/web2/routes/git.rs
251index d76eb1a..3be7c1f 100644
252--- a/ayllu/src/web2/routes/git.rs
253+++ b/ayllu/src/web2/routes/git.rs
254 @@ -1,13 +1,13 @@
255 use std::{io, path::Path, process::Stdio, str::FromStr};
256
257 use axum::{
258+ Extension,
259 body::Body,
260 http::{
261- header::{HeaderMap, HeaderName, HeaderValue},
262 Method, StatusCode, Uri,
263+ header::{HeaderMap, HeaderName, HeaderValue},
264 },
265 response::{IntoResponse, Response},
266- Extension,
267 };
268 use axum_extra::TypedHeader;
269
270 diff --git a/ayllu/src/web2/routes/robots.rs b/ayllu/src/web2/routes/robots.rs
271index fe40c5e..11b6c44 100644
272--- a/ayllu/src/web2/routes/robots.rs
273+++ b/ayllu/src/web2/routes/robots.rs
274 @@ -1,4 +1,4 @@
275- use axum::{response::IntoResponse, Extension};
276+ use axum::{Extension, response::IntoResponse};
277
278 use crate::config::Config;
279 use crate::web2::error::Error;
280 diff --git a/ayllu/src/web2/routes/rss.rs b/ayllu/src/web2/routes/rss.rs
281index 81fc8ae..d21818d 100644
282--- a/ayllu/src/web2/routes/rss.rs
283+++ b/ayllu/src/web2/routes/rss.rs
284 @@ -10,7 +10,7 @@ use axum::{
285 use mime::TEXT_XML;
286 use rss::{Channel, Guid, Item};
287 use serde::Serialize;
288- use time::{format_description::well_known::Rfc2822, macros::time, Duration, OffsetDateTime};
289+ use time::{Duration, OffsetDateTime, format_description::well_known::Rfc2822, macros::time};
290
291 use crate::config::{Collection, Config};
292 use crate::web2::error::Error;
293 @@ -29,9 +29,7 @@ fn html_commit(summary: String, message: String, stats: Option<Stats>) -> String
294 if let Some(stats) = stats {
295 stats_str = format!(
296 "<h5>Stats</h5><p><span class=\"positive\">+{}</span><span class=\"negative\"> -{}<span> +/-{}</span></p>",
297- stats.insertions,
298- stats.deletions,
299- stats.files_changed,
300+ stats.insertions, stats.deletions, stats.files_changed,
301 )
302 }
303 if summary == message.trim_end() {
304 @@ -454,7 +452,7 @@ pub async fn feed_repository_1m(
305 mod tests {
306
307 use super::*;
308- use time::{format_description::well_known::Rfc2822, macros::datetime, OffsetDateTime};
309+ use time::{OffsetDateTime, format_description::well_known::Rfc2822, macros::datetime};
310
311 use ayllu_git::testing;
312
313 @@ -502,14 +500,18 @@ mod tests {
314 )
315 .expect("failed to build items");
316 assert!(channel.items.len() == 2);
317- assert!(channel.items[0]
318- .title
319- .as_ref()
320- .is_some_and(|title| title == "Commit: commit 3"));
321- assert!(channel.items[1]
322- .title
323- .as_ref()
324- .is_some_and(|title| title == "Commit: commit 2"));
325+ assert!(
326+ channel.items[0]
327+ .title
328+ .as_ref()
329+ .is_some_and(|title| title == "Commit: commit 3")
330+ );
331+ assert!(
332+ channel.items[1]
333+ .title
334+ .as_ref()
335+ .is_some_and(|title| title == "Commit: commit 2")
336+ );
337 }
338
339 #[test]
340 @@ -551,22 +553,30 @@ mod tests {
341 )
342 .expect("failed to build items");
343 assert!(channel.items.len() == 3);
344- assert!(channel.items[0]
345- .title
346- .as_ref()
347- .is_some_and(|title| title == "Commit: commit 2"));
348- assert!(channel.items[1]
349- .title
350- .as_ref()
351- .is_some_and(|title| title == "Tag: v0.0.1"));
352- assert!(channel.items[1]
353- .description
354- .as_ref()
355- .is_some_and(|description| description == "release version 0.0.1!\n"));
356- assert!(channel.items[2]
357- .title
358- .as_ref()
359- .is_some_and(|title| title == "Commit: commit 1"));
360+ assert!(
361+ channel.items[0]
362+ .title
363+ .as_ref()
364+ .is_some_and(|title| title == "Commit: commit 2")
365+ );
366+ assert!(
367+ channel.items[1]
368+ .title
369+ .as_ref()
370+ .is_some_and(|title| title == "Tag: v0.0.1")
371+ );
372+ assert!(
373+ channel.items[1]
374+ .description
375+ .as_ref()
376+ .is_some_and(|description| description == "release version 0.0.1!\n")
377+ );
378+ assert!(
379+ channel.items[2]
380+ .title
381+ .as_ref()
382+ .is_some_and(|title| title == "Commit: commit 1")
383+ );
384 assert!(channel.items[0].guid.is_some());
385 // FIXME: assert!(channel.items[1].guid.is_some());
386 assert!(channel.items[2].guid.is_some());
387 diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs
388index 322c1a8..b7f5501 100644
389--- a/crates/config/src/lib.rs
390+++ b/crates/config/src/lib.rs
391 @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
392
393 pub use error::Error;
394 pub use flags::Command;
395- pub use reader::{data_dir, runtime_dir, Configurable, Reader};
396+ pub use reader::{Configurable, Reader, data_dir, runtime_dir};
397 use serde::{Deserialize, Serialize};
398
399 mod edit;
400 diff --git a/crates/database/src/build.rs b/crates/database/src/build.rs
401index 8ac8030..6168a82 100644
402--- a/crates/database/src/build.rs
403+++ b/crates/database/src/build.rs
404 @@ -18,7 +18,7 @@ impl From<Environment> for HashMap<String, Option<String>> {
405 let values: Vec<(String, Option<String>)> = val
406 .0
407 .iter()
408- .map(|env| (env.0 .0.clone(), env.0 .1.clone()))
409+ .map(|env| (env.0.0.clone(), env.0.1.clone()))
410 .collect();
411 HashMap::from_iter(values)
412 }
413 diff --git a/crates/database/src/lib.rs b/crates/database/src/lib.rs
414index cee98bc..2e3329f 100644
415--- a/crates/database/src/lib.rs
416+++ b/crates/database/src/lib.rs
417 @@ -1,9 +1,9 @@
418 use std::fs::create_dir_all;
419 use std::path::{Path, PathBuf};
420
421+ use sqlx::ConnectOptions;
422 use sqlx::migrate::Migrator;
423 use sqlx::sqlite::{SqliteConnectOptions, SqliteLockingMode, SqlitePool, SqlitePoolOptions};
424- use sqlx::ConnectOptions;
425 use sqlx::{Error as SqlxError, Sqlite, Transaction};
426 use tracing::log;
427
428 diff --git a/crates/git/src/lib.rs b/crates/git/src/lib.rs
429index dda3bd8..95e4ae0 100644
430--- a/crates/git/src/lib.rs
431+++ b/crates/git/src/lib.rs
432 @@ -2,7 +2,7 @@ pub use clone::clone;
433 pub use config::{ChatKind, ChatLink, Config, Sites};
434 pub use error::Error;
435 pub use lite::{Blob, Branch, Commit, Kind, Note, Stats, Tag, TreeEntry};
436- pub use scanner::{collection, collection_and_name, contains, git_dir, name, Scanner};
437+ pub use scanner::{Scanner, collection, collection_and_name, contains, git_dir, name};
438 pub use wrapper::{Selector, Wrapper};
439
440 mod clone;
441 diff --git a/crates/git/src/scanner.rs b/crates/git/src/scanner.rs
442index 1ae9b21..153071c 100644
443--- a/crates/git/src/scanner.rs
444+++ b/crates/git/src/scanner.rs
445 @@ -1,4 +1,4 @@
446- use std::fs::{metadata, read_dir, ReadDir};
447+ use std::fs::{ReadDir, metadata, read_dir};
448 use std::io::Error;
449 use std::path::{Path, PathBuf};
450
451 diff --git a/crates/logging/src/lib.rs b/crates/logging/src/lib.rs
452index c73374a..cc70cfa 100644
453--- a/crates/logging/src/lib.rs
454+++ b/crates/logging/src/lib.rs
455 @@ -1,6 +1,6 @@
456 use std::{
457 env,
458- fs::{create_dir_all, File},
459+ fs::{File, create_dir_all},
460 io::Error as IoError,
461 path::{Path, PathBuf},
462 sync::Mutex,
463 @@ -8,8 +8,8 @@ use std::{
464
465 use tracing::Level;
466 use tracing_subscriber::fmt::{
467- format::{Compact, DefaultFields, Format},
468 SubscriberBuilder,
469+ format::{Compact, DefaultFields, Format},
470 };
471
472 fn get_subscriber(level: Level) -> SubscriberBuilder<DefaultFields, Format<Compact>> {
473 @@ -22,9 +22,10 @@ fn get_subscriber(level: Level) -> SubscriberBuilder<DefaultFields, Format<Compa
474
475 fn try_setup_file(path: &Path) -> Result<File, IoError> {
476 if let Some(parent_dir) = path.parent()
477- && !parent_dir.exists() {
478- create_dir_all(parent_dir)?;
479- }
480+ && !parent_dir.exists()
481+ {
482+ create_dir_all(parent_dir)?;
483+ }
484 let fp = std::fs::OpenOptions::new()
485 .create(true)
486 .append(true)