Commit

Author:

Hash:

Timestamp:

+49 -51 +/-18 browse

Kevin Schoon [me@kevinschoon.com]

82c678a2fa0ce04fb24595d25fff27084c200f2a

Sun, 06 Jul 2025 19:45:32 +0000 (4 days ago)

appease clippy
1diff --git a/ayllu/src/highlight.rs b/ayllu/src/highlight.rs
2index e21411b..a603268 100644
3--- a/ayllu/src/highlight.rs
4+++ b/ayllu/src/highlight.rs
5 @@ -50,7 +50,7 @@ unsafe fn load_language(path: &str, hint: &Hint) -> Language {
6 // for tree-sitter function names.
7 let method_name = format!("tree_sitter_{}", hint.0.to_lowercase().replace('-', "_"));
8 // NOTE: maybe, probably? some security auditing that needs to happen here?
9- debug!("attempting to load method: {}", method_name);
10+ debug!("attempting to load method: {method_name}");
11 let func: libloading::Symbol<unsafe extern "C" fn() -> Language> =
12 lib.get(method_name.as_bytes()).unwrap();
13 let language = func();
14 @@ -139,7 +139,7 @@ impl Loader {
15 debug!("loaded [{:?}] {}", hint, query.path().display());
16 }
17 name => {
18- debug!("ignoring query file: {}", name)
19+ debug!("ignoring query file: {name}")
20 }
21 }
22 }
23 @@ -149,7 +149,7 @@ impl Loader {
24 .write()
25 .unwrap()
26 .insert(hint.clone(), overrides.clone());
27- debug!("user supplied their own highlights.scm for {:?}", hint);
28+ debug!("user supplied their own highlights.scm for {hint:?}");
29 }
30 Ok(())
31 }
32 @@ -249,7 +249,7 @@ fn render_lines(lines: Vec<&str>, show_line_numbers: bool) -> String {
33 )
34 .unwrap();
35 } else {
36- write!(&mut file, "<tr><td class=line>{}</td></tr>", line).unwrap();
37+ write!(&mut file, "<tr><td class=line>{line}</td></tr>").unwrap();
38 }
39 if n_chars > accm {
40 n_chars
41 @@ -297,7 +297,7 @@ impl Highlighter {
42 None => LANGUAGE_TABLE.guess(code, alias, filepath),
43 };
44
45- debug!("language hint: {:?}", hint);
46+ debug!("language hint: {hint:?}");
47
48 match hint {
49 Some(hint) => match (
50 @@ -305,7 +305,7 @@ impl Highlighter {
51 HIGHLIGHTS.read().unwrap().get(&hint),
52 ) {
53 (Some(language), Some(syntax)) => {
54- debug!("painting syntax for language: {:?}", hint);
55+ debug!("painting syntax for language: {hint:?}");
56 let mut highlighter = TSHighlighter::new();
57 let injections = INJECTIONS
58 .read()
59 @@ -350,7 +350,7 @@ impl Highlighter {
60 )
61 }
62 _ => {
63- debug!("cannot paint syntax for language: {:?}", hint);
64+ debug!("cannot paint syntax for language: {hint:?}");
65 let escaped = askama::filters::escape(code, askama::filters::Html).unwrap();
66 (
67 None,
68 diff --git a/ayllu/src/web2/error.rs b/ayllu/src/web2/error.rs
69index aebbd59..6e30907 100644
70--- a/ayllu/src/web2/error.rs
71+++ b/ayllu/src/web2/error.rs
72 @@ -33,16 +33,16 @@ impl IntoResponse for Error {
73
74 impl From<ApiError> for Error {
75 fn from(value: ApiError) -> Self {
76- Error::Message(format!("RPC [ayllu]: {:?}", value))
77+ Error::Message(format!("RPC [ayllu]: {value:?}"))
78 }
79 }
80
81 impl From<GitError> for Error {
82 fn from(value: GitError) -> Self {
83 if value.not_found() {
84- Error::NotFound(format!("GIT: {:?}", value))
85+ Error::NotFound(format!("GIT: {value:?}"))
86 } else {
87- Error::Message(format!("GIT: {:?}", value))
88+ Error::Message(format!("GIT: {value:?}"))
89 }
90 }
91 }
92 @@ -50,14 +50,14 @@ impl From<GitError> for Error {
93 impl From<IoError> for Error {
94 fn from(value: IoError) -> Self {
95 match value.kind() {
96- std::io::ErrorKind::NotFound => Error::NotFound(format!("IO: {}", value)),
97- _ => Error::Message(format!("IO: {:?}", value)),
98+ std::io::ErrorKind::NotFound => Error::NotFound(format!("IO: {value}")),
99+ _ => Error::Message(format!("IO: {value:?}")),
100 }
101 }
102 }
103
104 impl From<askama::Error> for Error {
105 fn from(value: askama::Error) -> Self {
106- Error::Message(format!("Template Error: {:?}", value))
107+ Error::Message(format!("Template Error: {value:?}"))
108 }
109 }
110 diff --git a/ayllu/src/web2/middleware/error.rs b/ayllu/src/web2/middleware/error.rs
111index 7a0e9a1..e917064 100644
112--- a/ayllu/src/web2/middleware/error.rs
113+++ b/ayllu/src/web2/middleware/error.rs
114 @@ -44,7 +44,7 @@ pub async fn middleware(
115 Error::ComponentNotEnabled(_) => StatusCode::INTERNAL_SERVER_ERROR,
116 };
117 if status_code == StatusCode::NOT_FOUND {
118- log::warn!("Not Found: {}", error);
119+ log::warn!("Not Found: {error}");
120 return Html::from(
121 NotFoundPage {
122 base: Base {
123 @@ -59,7 +59,7 @@ pub async fn middleware(
124 )
125 .into_response();
126 } else {
127- log::error!("Error: {}", error);
128+ log::error!("Error: {error}");
129 return Html::from(
130 ErrorPage {
131 base: Base {
132 diff --git a/ayllu/src/web2/middleware/sites.rs b/ayllu/src/web2/middleware/sites.rs
133index 0f84b94..664befe 100644
134--- a/ayllu/src/web2/middleware/sites.rs
135+++ b/ayllu/src/web2/middleware/sites.rs
136 @@ -46,7 +46,7 @@ pub fn sites(cfg: &Config) -> Result<Sites, Error> {
137 Some((key, value)) => {
138 let repo_path = path.to_str().unwrap().to_string();
139 sites.push((repo_path.to_string(), (key.to_string(), value.to_string())));
140- log::info!("serving static site {} -> {}", domain, repo_path);
141+ log::info!("serving static site {domain} -> {repo_path}");
142 }
143 None => panic!("bad key=value header"),
144 };
145 @@ -72,10 +72,10 @@ pub async fn middleware(
146 .map(|header| header.to_str().unwrap_or(""));
147
148 for (other_repo_path, (key, value)) in sites {
149- log::debug!("checking site {} {}={}", other_repo_path, key, value);
150+ log::debug!("checking site {other_repo_path} {key}={value}");
151 if let Some(header_value) = headers.get(key.as_str()) {
152 if header_value.to_str().unwrap() == value {
153- log::debug!("sites header match: {}={}", key, value);
154+ log::debug!("sites header match: {key}={value}");
155 repo_path = Some(other_repo_path.to_string());
156 break;
157 // return self.serve(req, repo_path).await;
158 @@ -117,11 +117,11 @@ pub async fn middleware(
159 paths.push(blob_path.clone().with_extension("html"));
160 paths.push(blob_path.clone().with_extension("htm"));
161 };
162- log::debug!("trying paths: {:?}", paths);
163+ log::debug!("trying paths: {paths:?}");
164 for path in paths {
165- log::debug!("trying path {:?}", path);
166+ log::debug!("trying path {path:?}");
167 if let Some(blob) = repository.blob(path.as_path(), config.sites.branch.clone())? {
168- log::debug!("got blob from path {:?}", path);
169+ log::debug!("got blob from path {path:?}");
170 let mime_type = from_path(path.to_str().unwrap()).first_or_octet_stream();
171 let response = Response::builder()
172 .header(header::CONTENT_TYPE, mime_type.to_string())
173 diff --git a/ayllu/src/web2/navigation.rs b/ayllu/src/web2/navigation.rs
174index 43e19a3..90d56d5 100644
175--- a/ayllu/src/web2/navigation.rs
176+++ b/ayllu/src/web2/navigation.rs
177 @@ -37,17 +37,17 @@ pub fn primary(current_page: &str, collection: &str, name: &str) -> Items {
178 // ),
179 (
180 String::from("project"),
181- format!("/{}/{}", collection, name),
182+ format!("/{collection}/{name}"),
183 current_page == "project",
184 ),
185 (
186 String::from("log"),
187- format!("/{}/{}/log", collection, name),
188+ format!("/{collection}/{name}/log"),
189 current_page == "log",
190 ),
191 (
192 String::from("refs"),
193- format!("/{}/{}/refs", collection, name),
194+ format!("/{collection}/{name}/refs"),
195 current_page == "refs",
196 ),
197 ]
198 @@ -64,25 +64,24 @@ pub fn subnav(
199 vec![
200 (
201 String::from("blob"),
202- format!("/{}/{}/blob/{}/{}", collection, name, ref_name, file_path,),
203+ format!("/{collection}/{name}/blob/{ref_name}/{file_path}",),
204 current_page == "blob",
205 ),
206 (
207 String::from("log"),
208- format!("/{}/{}/log/{}/{}", collection, name, ref_name, file_path,),
209+ format!("/{collection}/{name}/log/{ref_name}/{file_path}",),
210 current_page == "log",
211 ),
212 (
213 String::from("permalink"),
214 format!(
215- "/{}/{}/{}/{}/{}",
216- collection, name, current_page, commit_id, file_path
217+ "/{collection}/{name}/{current_page}/{commit_id}/{file_path}"
218 ),
219 false,
220 ),
221 (
222 String::from("raw"),
223- format!("/{}/{}/raw/{}/{}", collection, name, ref_name, file_path),
224+ format!("/{collection}/{name}/raw/{ref_name}/{file_path}"),
225 false,
226 ),
227 ]
228 diff --git a/ayllu/src/web2/routes/blob.rs b/ayllu/src/web2/routes/blob.rs
229index 29d8d64..72ba6ab 100644
230--- a/ayllu/src/web2/routes/blob.rs
231+++ b/ayllu/src/web2/routes/blob.rs
232 @@ -66,7 +66,7 @@ pub async fn serve(
233 base.title = preamble.file_name();
234 base.nav_elements = navigation::primary("blob", &preamble.collection_name, &preamble.repo_name);
235 let mime_type = mime_guess::from_path(preamble.file_path_string()).first_or_octet_stream();
236- log::debug!("rendering blob with mime type: {}", mime_type);
237+ log::debug!("rendering blob with mime type: {mime_type}");
238 let mut content: Option<String> = None;
239 let mut is_image = false;
240 let mut is_video = false;
241 @@ -167,7 +167,7 @@ pub async fn serve_raw(
242 preamble.repo_name.as_str(),
243 blob.oid.as_str(),
244 );
245- log::debug!("redirecting blob to LFS server: {}", location);
246+ log::debug!("redirecting blob to LFS server: {location}");
247 Ok(Redirect::permanent(&location).into_response())
248 } else {
249 let mime = if blob.is_binary {
250 diff --git a/ayllu/src/web2/routes/commit.rs b/ayllu/src/web2/routes/commit.rs
251index e56265d..17597a8 100644
252--- a/ayllu/src/web2/routes/commit.rs
253+++ b/ayllu/src/web2/routes/commit.rs
254 @@ -33,7 +33,7 @@ pub async fn serve(
255 Extension(mut base): Extension<Base>,
256 ) -> Result<Html<String>, Error> {
257 let repository = Wrapper::new(preamble.repo_path.as_path())?;
258- base.title = format!("Commit: {}", commit_id);
259+ base.title = format!("Commit: {commit_id}");
260 base.nav_elements =
261 navigation::primary("commit", &preamble.collection_name, &preamble.repo_name);
262 let commit = repository.commit(Some(commit_id.to_string()))?.unwrap();
263 diff --git a/ayllu/src/web2/routes/finger.rs b/ayllu/src/web2/routes/finger.rs
264index 648eb1e..39674bb 100644
265--- a/ayllu/src/web2/routes/finger.rs
266+++ b/ayllu/src/web2/routes/finger.rs
267 @@ -131,7 +131,7 @@ impl Resolver {
268 if resource
269 .path()
270 .trim_start_matches("/")
271- .eq(&format!("{}/{}", collection_str, name))
272+ .eq(&format!("{collection_str}/{name}"))
273 && resource.host().is_some_and(|resource_host| {
274 resource_host.eq(self.origin.host_str().unwrap_or_default())
275 })
276 diff --git a/ayllu/src/web2/routes/git.rs b/ayllu/src/web2/routes/git.rs
277index 08d3205..2ae5c3a 100644
278--- a/ayllu/src/web2/routes/git.rs
279+++ b/ayllu/src/web2/routes/git.rs
280 @@ -121,7 +121,7 @@ pub async fn handle(
281 .stderr(Stdio::piped())
282 .kill_on_drop(true);
283
284- log::debug!("calling {:?}", cmd);
285+ log::debug!("calling {cmd:?}");
286
287 if cfg.git.export_all {
288 cmd = cmd.env("GIT_HTTP_EXPORT_ALL", "true");
289 diff --git a/ayllu/src/web2/routes/index.rs b/ayllu/src/web2/routes/index.rs
290index 7219a35..1ea1f69 100644
291--- a/ayllu/src/web2/routes/index.rs
292+++ b/ayllu/src/web2/routes/index.rs
293 @@ -115,7 +115,7 @@ pub async fn collection(
294 }
295 let entry = entry.unwrap();
296 let repositories = load_repositories(entry.path.as_str()).await?;
297- base.title = format!("{:?}", collection);
298+ base.title = format!("{collection:?}");
299 base.nav_elements = crate::web2::navigation::global("index", false);
300 base.current_time = timeutil::timestamp();
301 let page = CollectionPageTemplate {
302 diff --git a/ayllu/src/web2/routes/refs.rs b/ayllu/src/web2/routes/refs.rs
303index c45aa95..4669293 100644
304--- a/ayllu/src/web2/routes/refs.rs
305+++ b/ayllu/src/web2/routes/refs.rs
306 @@ -77,7 +77,7 @@ pub async fn tag(
307 .render()?,
308 ))
309 } else {
310- Err(Error::NotFound(format!("Tag: {} Not Found", tag_name)))
311+ Err(Error::NotFound(format!("Tag: {tag_name} Not Found")))
312 }
313 }
314
315 diff --git a/crates/config/src/edit.rs b/crates/config/src/edit.rs
316index ced3bce..5e3342e 100644
317--- a/crates/config/src/edit.rs
318+++ b/crates/config/src/edit.rs
319 @@ -94,7 +94,7 @@ impl Editor {
320 pub fn set(&self, key_path: &str, value_str: &str) -> Result<(), Error> {
321 // BUG: this is a hack, I can't figure out how to do this properly via
322 // serde / serde_toml, maybe it's not possible, I don't know.
323- let value: toml::value::Value = toml::from_str(&format!("x = {}", value_str))?;
324+ let value: toml::value::Value = toml::from_str(&format!("x = {value_str}"))?;
325 let value = value.get("x").unwrap();
326 let (cfg_path, cfg_str) = self.get_cfg()?;
327 let mut doc = cfg_str.parse::<DocumentMut>()?;
328 diff --git a/crates/config/src/flags.rs b/crates/config/src/flags.rs
329index d2f32b8..9048df1 100644
330--- a/crates/config/src/flags.rs
331+++ b/crates/config/src/flags.rs
332 @@ -42,7 +42,7 @@ impl Command {
333 match self {
334 Command::Get { key } => {
335 let value = Editor(path).get(&key)?;
336- println!("{}", value);
337+ println!("{value}");
338 Ok(())
339 }
340 Command::Set { key, value } => Editor(path).set(&key, &value),
341 @@ -61,7 +61,7 @@ impl Command {
342 }
343 }
344 Command::Generate => {
345- print!("{}", example_cfg);
346+ print!("{example_cfg}");
347 Ok(())
348 }
349 }
350 diff --git a/crates/git/src/error.rs b/crates/git/src/error.rs
351index 5bd0c87..d7393c0 100644
352--- a/crates/git/src/error.rs
353+++ b/crates/git/src/error.rs
354 @@ -65,7 +65,7 @@ impl Display for Error {
355 ErrorKind::BlobIsBinary => write!(f, "blob is a binary file"),
356 ErrorKind::ObjectNotATree => write!(f, "object is not a tree"),
357 ErrorKind::NotAReference => write!(f, "reference is invalid"),
358- ErrorKind::ConfigError(ref msg) => write!(f, "config is invalid: {}", msg),
359+ ErrorKind::ConfigError(ref msg) => write!(f, "config is invalid: {msg}"),
360 }
361 }
362 }
363 diff --git a/crates/git/src/wrapper.rs b/crates/git/src/wrapper.rs
364index e7a107c..fd1e292 100644
365--- a/crates/git/src/wrapper.rs
366+++ b/crates/git/src/wrapper.rs
367 @@ -1114,9 +1114,9 @@ mod tests {
368 let timestamp_2 = "Fri Jul 14 02:40:01 AM UTC 2017"; // @1500000001
369 let timestamp_3 = "Sun Sep 13 12:26:40 PM UTC 2020"; // @1600000000
370 let mut test_repo = testing::Builder::default().with_commands(vec![
371- format!("echo 'content' > file_1.txt && git add file_1.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 1'", timestamp_1, timestamp_1).as_str(),
372- format!("echo 'content' > file_2.txt && git add file_2.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 2'", timestamp_2, timestamp_2).as_str(),
373- format!("echo 'content' > file_3.txt && git add file_3.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 3'", timestamp_3, timestamp_3).as_str(),
374+ format!("echo 'content' > file_1.txt && git add file_1.txt && GIT_COMMITTER_DATE='{timestamp_1}' GIT_AUTHOR_DATE='{timestamp_1}' git commit -m 'commit 1'").as_str(),
375+ format!("echo 'content' > file_2.txt && git add file_2.txt && GIT_COMMITTER_DATE='{timestamp_2}' GIT_AUTHOR_DATE='{timestamp_2}' git commit -m 'commit 2'").as_str(),
376+ format!("echo 'content' > file_3.txt && git add file_3.txt && GIT_COMMITTER_DATE='{timestamp_3}' GIT_AUTHOR_DATE='{timestamp_3}' git commit -m 'commit 3'").as_str(),
377 ]);
378 let repo_path = test_repo.build().expect("failed to init repo").1;
379 let repository = Wrapper::new(&repo_path).expect("failed to load repository");
380 @@ -1134,12 +1134,12 @@ mod tests {
381 let timestamp_2 = "Fri Jul 14 02:40:01 AM UTC 2017"; // @1500000001
382 let timestamp_3 = "Sun Sep 13 12:26:40 PM UTC 2020"; // @1600000000
383 let mut test_repo = testing::Builder::default().with_commands(vec![
384- format!("echo 'content' > file_1.txt && git add file_1.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 1'", timestamp_1, timestamp_1).as_str(),
385+ format!("echo 'content' > file_1.txt && git add file_1.txt && GIT_COMMITTER_DATE='{timestamp_1}' GIT_AUTHOR_DATE='{timestamp_1}' git commit -m 'commit 1'").as_str(),
386 // branch within the requested timeframe
387 "git checkout -b hello-world",
388- format!("echo 'content' > file_2.txt && git add file_2.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 2'", timestamp_2, timestamp_2).as_str(),
389+ format!("echo 'content' > file_2.txt && git add file_2.txt && GIT_COMMITTER_DATE='{timestamp_2}' GIT_AUTHOR_DATE='{timestamp_2}' git commit -m 'commit 2'").as_str(),
390 // third commit exceeds the timeframe
391- format!("echo 'content' > file_3.txt && git add file_3.txt && GIT_COMMITTER_DATE='{}' GIT_AUTHOR_DATE='{}' git commit -m 'commit 3'", timestamp_3, timestamp_3).as_str(),
392+ format!("echo 'content' > file_3.txt && git add file_3.txt && GIT_COMMITTER_DATE='{timestamp_3}' GIT_AUTHOR_DATE='{timestamp_3}' git commit -m 'commit 3'").as_str(),
393 // more commits outside of timeframe and another branch
394 "git checkout main && git checkout -b another-branch",
395 "echo 'content' > file_4.txt && git add file_4.txt && git commit -m 'commit 5'",
396 diff --git a/crates/logging/src/lib.rs b/crates/logging/src/lib.rs
397index 2180f74..0abceb6 100644
398--- a/crates/logging/src/lib.rs
399+++ b/crates/logging/src/lib.rs
400 @@ -44,9 +44,9 @@ pub fn cannonical(name: &str) -> PathBuf {
401 match env::var("XDG_RUNTIME_DIR") {
402 Ok(value) => {
403 let base = PathBuf::from(value);
404- base.join(format!("{}.log", name))
405+ base.join(format!("{name}.log"))
406 }
407- Err(_) => PathBuf::from_iter([String::from("/tmp"), format!("{}.log", name)]),
408+ Err(_) => PathBuf::from_iter([String::from("/tmp"), format!("{name}.log")]),
409 }
410 }
411
412 diff --git a/quipu/src/client.rs b/quipu/src/client.rs
413index 300e24e..ebdcc80 100644
414--- a/quipu/src/client.rs
415+++ b/quipu/src/client.rs
416 @@ -35,7 +35,7 @@ impl Quipu {
417 .host(self.endpoint.authority())
418 .build();
419 let result = request.execute_reqwest_with_client(&self.client).await?;
420- println!("{}", result);
421+ println!("{result}");
422 Ok(())
423 }
424 }
425 diff --git a/quipu/src/main.rs b/quipu/src/main.rs
426index c4bc76e..e2d6b2a 100644
427--- a/quipu/src/main.rs
428+++ b/quipu/src/main.rs
429 @@ -70,8 +70,7 @@ fn get_instance(
430 Ok(instance)
431 } else {
432 Err(error::QuipuError::Message(format!(
433- "no configured instance: {}",
434- name
435+ "no configured instance: {name}"
436 )))
437 }
438 } else if let Some(instance) = cfg.default_instance() {