Author:
Hash:
Timestamp:
+16 -23 +/-9 browse
Kevin Schoon [me@kevinschoon.com]
354cbfa575aed8e72de7bafd7ef1c79ffe41088f
Fri, 23 May 2025 22:50:25 +0000 (5 months ago)
| 1 | diff --git a/ayllu/src/config.rs b/ayllu/src/config.rs |
| 2 | index bdcb3b4..d52b9fa 100644 |
| 3 | --- a/ayllu/src/config.rs |
| 4 | +++ b/ayllu/src/config.rs |
| 5 | @@ -316,11 +316,11 @@ impl Configurable for Config { |
| 6 | self.domain = parsed_url.domain().map(|domain| domain.to_string()); |
| 7 | |
| 8 | // verify collection names are all valid |
| 9 | - if let Some(collection) = self.collections.iter().find(|collection| { |
| 10 | - BANNED_COLLECTION_NAMES |
| 11 | - .iter() |
| 12 | - .any(|name| *name == collection.name.as_str()) |
| 13 | - }) { |
| 14 | + if let Some(collection) = self |
| 15 | + .collections |
| 16 | + .iter() |
| 17 | + .find(|collection| BANNED_COLLECTION_NAMES.contains(&collection.name.as_str())) |
| 18 | + { |
| 19 | return Err(format!("{} is a reserved name", collection.name) |
| 20 | .as_str() |
| 21 | .into()); |
| 22 | diff --git a/ayllu/src/web2/middleware/error.rs b/ayllu/src/web2/middleware/error.rs |
| 23 | index a8e1424..7a0e9a1 100644 |
| 24 | --- a/ayllu/src/web2/middleware/error.rs |
| 25 | +++ b/ayllu/src/web2/middleware/error.rs |
| 26 | @@ -44,7 +44,7 @@ pub async fn middleware( |
| 27 | Error::ComponentNotEnabled(_) => StatusCode::INTERNAL_SERVER_ERROR, |
| 28 | }; |
| 29 | if status_code == StatusCode::NOT_FOUND { |
| 30 | - log::warn!("Not Found: {}", error.to_string()); |
| 31 | + log::warn!("Not Found: {}", error); |
| 32 | return Html::from( |
| 33 | NotFoundPage { |
| 34 | base: Base { |
| 35 | @@ -59,7 +59,7 @@ pub async fn middleware( |
| 36 | ) |
| 37 | .into_response(); |
| 38 | } else { |
| 39 | - log::error!("Error: {}", error.to_string()); |
| 40 | + log::error!("Error: {}", error); |
| 41 | return Html::from( |
| 42 | ErrorPage { |
| 43 | base: Base { |
| 44 | diff --git a/ayllu/src/web2/routes/blob.rs b/ayllu/src/web2/routes/blob.rs |
| 45 | index 5868a4d..29d8d64 100644 |
| 46 | --- a/ayllu/src/web2/routes/blob.rs |
| 47 | +++ b/ayllu/src/web2/routes/blob.rs |
| 48 | @@ -25,7 +25,7 @@ use crate::{ |
| 49 | highlight::{Highlighter, TreeSitterAdapter}, |
| 50 | with_preamble, |
| 51 | }; |
| 52 | - use ayllu_git::{Blob, Wrapper}; |
| 53 | + use ayllu_git::Wrapper; |
| 54 | |
| 55 | #[derive(Template)] |
| 56 | #[template(path = "blob.html")] |
| 57 | @@ -129,7 +129,7 @@ pub async fn serve( |
| 58 | file_size: (file_size as f64), |
| 59 | file_mode_: file_mode, |
| 60 | file_name: &preamble.file_name(), |
| 61 | - mime_type: &mime_type.to_string(), |
| 62 | + mime_type: mime_type.as_ref(), |
| 63 | is_image, |
| 64 | is_video, |
| 65 | is_binary, |
| 66 | diff --git a/ayllu/src/web2/routes/config.rs b/ayllu/src/web2/routes/config.rs |
| 67 | index 957b9d4..04cd51d 100644 |
| 68 | --- a/ayllu/src/web2/routes/config.rs |
| 69 | +++ b/ayllu/src/web2/routes/config.rs |
| 70 | @@ -13,6 +13,7 @@ use crate::{config::Config as SystemConfig, web2::template::Base}; |
| 71 | |
| 72 | #[derive(Template)] |
| 73 | #[template(path = "config.html")] |
| 74 | + #[allow(dead_code)] |
| 75 | struct Index<'a> { |
| 76 | base: Base, |
| 77 | themes: Vec<String>, |
| 78 | diff --git a/ayllu/src/web2/routes/git.rs b/ayllu/src/web2/routes/git.rs |
| 79 | index eddde5a..08d3205 100644 |
| 80 | --- a/ayllu/src/web2/routes/git.rs |
| 81 | +++ b/ayllu/src/web2/routes/git.rs |
| 82 | @@ -1,4 +1,4 @@ |
| 83 | - use std::{io, io::ErrorKind, path::Path, process::Stdio, str::FromStr}; |
| 84 | + use std::{io, path::Path, process::Stdio, str::FromStr}; |
| 85 | |
| 86 | use axum::{ |
| 87 | body::Body, |
| 88 | @@ -134,10 +134,7 @@ pub async fn handle( |
| 89 | let mut stdin = child.stdin.take().unwrap(); |
| 90 | |
| 91 | // read request body and forward to stdin |
| 92 | - let mut body = StreamReader::new( |
| 93 | - body.into_data_stream() |
| 94 | - .map_err(|e| std::io::Error::new(ErrorKind::Other, e)), |
| 95 | - ); |
| 96 | + let mut body = StreamReader::new(body.into_data_stream().map_err(std::io::Error::other)); |
| 97 | |
| 98 | let n_bytes = tokio::io::copy_buf(&mut body, &mut stdin).await?; |
| 99 | debug!("read {} bytes from client", n_bytes); |
| 100 | diff --git a/ayllu/src/web2/routes/log.rs b/ayllu/src/web2/routes/log.rs |
| 101 | index c872752..b648da2 100644 |
| 102 | --- a/ayllu/src/web2/routes/log.rs |
| 103 | +++ b/ayllu/src/web2/routes/log.rs |
| 104 | @@ -16,6 +16,7 @@ use ayllu_git::{Commit, Selector, Wrapper}; |
| 105 | |
| 106 | #[derive(Template)] |
| 107 | #[template(path = "log.html")] |
| 108 | + #[allow(dead_code)] |
| 109 | struct PageTemplate<'a> { |
| 110 | base: Base, |
| 111 | collection: &'a str, |
| 112 | diff --git a/ayllu/src/web2/routes/repo.rs b/ayllu/src/web2/routes/repo.rs |
| 113 | index e7ebde3..b32c723 100644 |
| 114 | --- a/ayllu/src/web2/routes/repo.rs |
| 115 | +++ b/ayllu/src/web2/routes/repo.rs |
| 116 | @@ -1,11 +1,7 @@ |
| 117 | use std::path::PathBuf; |
| 118 | |
| 119 | use askama::Template; |
| 120 | - use axum::{ |
| 121 | - debug_handler, |
| 122 | - extract::{Extension, OriginalUri}, |
| 123 | - response::Html, |
| 124 | - }; |
| 125 | + use axum::{debug_handler, extract::Extension, response::Html}; |
| 126 | use serde::Serialize; |
| 127 | |
| 128 | use crate::{ |
| 129 | @@ -21,7 +17,6 @@ use crate::web2::error::Error; |
| 130 | use crate::web2::middleware::repository::Preamble; |
| 131 | use crate::web2::navigation; |
| 132 | use crate::web2::template::filters; |
| 133 | - use crate::web2::util; |
| 134 | |
| 135 | use ayllu_git::{Commit, Config as GitConfig, TreeEntry, Wrapper}; |
| 136 | |
| 137 | @@ -66,6 +61,7 @@ pub struct EmailLink { |
| 138 | |
| 139 | #[derive(askama::Template)] |
| 140 | #[template(path = "repo.html")] |
| 141 | + #[allow(dead_code)] |
| 142 | struct PageTemplate<'a> { |
| 143 | pub base: Base, |
| 144 | pub collection: &'a str, |
| 145 | @@ -92,7 +88,6 @@ struct PageTemplate<'a> { |
| 146 | #[debug_handler] |
| 147 | #[allow(clippy::too_many_arguments)] |
| 148 | pub async fn serve( |
| 149 | - uri: OriginalUri, |
| 150 | Extension(cfg): Extension<Config>, |
| 151 | Extension(preamble): Extension<Preamble>, |
| 152 | Extension(adapter): Extension<TreeSitterAdapter>, |
| 153 | diff --git a/ayllu/src/web2/routes/rss.rs b/ayllu/src/web2/routes/rss.rs |
| 154 | index c394c63..98891e2 100644 |
| 155 | --- a/ayllu/src/web2/routes/rss.rs |
| 156 | +++ b/ayllu/src/web2/routes/rss.rs |
| 157 | @@ -262,7 +262,7 @@ impl Builder { |
| 158 | n_commits: all_data.iter().fold(0, |accm, entries| { |
| 159 | accm + entries.commits.as_ref().map_or(0, |commits| commits.len()) |
| 160 | }), |
| 161 | - n_projects: if all_data.len() == 0 { |
| 162 | + n_projects: if all_data.is_empty() { |
| 163 | None |
| 164 | } else { |
| 165 | Some(all_data.len()) |
| 166 | diff --git a/clippy.toml b/clippy.toml |
| 167 | deleted file mode 100644 |
| 168 | index c3aa642..0000000 |
| 169 | --- a/clippy.toml |
| 170 | +++ /dev/null |
| 171 | @@ -1 +0,0 @@ |
| 172 | - msrv = "1.82.0" |