fixed clippy errors
Rust lint and build / Rust CI (push) Failing after 42s

This commit is contained in:
2026-06-03 09:52:12 +02:00
parent 81d775a7dd
commit 6924ae17df
5 changed files with 24 additions and 22 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ impl WikiGraph {
); );
} }
println!(""); println!();
// Edges // Edges
for (source, targets) in &self.edges { for (source, targets) in &self.edges {
+15 -14
View File
@@ -106,10 +106,11 @@ async fn update_from_git(changelog_path: &Path, git_dir: &Path, wiki_root: &Path
for line in stdout.lines() { for line in stdout.lines() {
if line.starts_with("---ENTRY---|") { if line.starts_with("---ENTRY---|") {
// Push previous // Push previous
if let Some(entry) = current_entry.take() { if let Some(entry) = current_entry.take()
if !entry.files.is_empty() && !existing_hashes.contains(&entry.hash) { && !entry.files.is_empty()
new_entries.push(entry); && !existing_hashes.contains(&entry.hash)
} {
new_entries.push(entry);
} }
// Parse new // Parse new
@@ -153,10 +154,11 @@ async fn update_from_git(changelog_path: &Path, git_dir: &Path, wiki_root: &Path
} }
// Push last // Push last
if let Some(entry) = current_entry { if let Some(entry) = current_entry
if !entry.files.is_empty() && !existing_hashes.contains(&entry.hash) { && !entry.files.is_empty()
new_entries.push(entry); && !existing_hashes.contains(&entry.hash)
} {
new_entries.push(entry);
} }
if new_entries.is_empty() { if new_entries.is_empty() {
@@ -180,12 +182,11 @@ async fn update_from_git(changelog_path: &Path, git_dir: &Path, wiki_root: &Path
pub async fn load_changelog(root_dir: &Path) -> Vec<ChangelogEntry> { pub async fn load_changelog(root_dir: &Path) -> Vec<ChangelogEntry> {
let path = root_dir.join("_changelog.toml"); let path = root_dir.join("_changelog.toml");
if path.exists() { if path.exists()
if let Ok(content) = fs::read_to_string(path).await { && let Ok(content) = fs::read_to_string(path).await
if let Ok(config) = toml::from_str::<ChangelogConfig>(&content) { && let Ok(config) = toml::from_str::<ChangelogConfig>(&content)
return config.entries; {
} return config.entries;
}
} }
Vec::new() Vec::new()
} }
+5 -4
View File
@@ -1,6 +1,7 @@
use anyhow::{Context, Result, anyhow}; use anyhow::{Context, Result, anyhow};
use colored::Colorize; use colored::Colorize;
use std::path::PathBuf; use std::path::PathBuf;
use std::path::Path;
use tokio::fs; use tokio::fs;
use crate::WikiConfig; use crate::WikiConfig;
@@ -59,7 +60,7 @@ async fn list_entries(root: &PathBuf) -> Result<()> {
Ok(()) Ok(())
} }
fn check_file_status(root: &PathBuf, filename: Option<String>) -> String { fn check_file_status(root: &Path, filename: Option<String>) -> String {
match filename { match filename {
Some(f) => { Some(f) => {
let path = root.join("images").join(&f); let path = root.join("images").join(&f);
@@ -73,7 +74,7 @@ fn check_file_status(root: &PathBuf, filename: Option<String>) -> String {
} }
} }
async fn create_entry(root: &PathBuf, title: &str, category: Option<String>) -> Result<()> { async fn create_entry(root: &Path, title: &str, category: Option<String>) -> Result<()> {
let slug: String = title let slug: String = title
.trim() .trim()
.to_lowercase() .to_lowercase()
@@ -139,7 +140,7 @@ content_file = "{}"
Ok(()) Ok(())
} }
async fn remove_entry(root: &PathBuf, name: &str) -> Result<()> { async fn remove_entry(root: &Path, name: &str) -> Result<()> {
let toml_path = root.join(format!("{}.toml", name)); let toml_path = root.join(format!("{}.toml", name));
if !toml_path.exists() { if !toml_path.exists() {
@@ -176,7 +177,7 @@ async fn remove_entry(root: &PathBuf, name: &str) -> Result<()> {
Ok(()) Ok(())
} }
async fn inspect_entry(root: &PathBuf, name: &str) -> Result<()> { async fn inspect_entry(root: &Path, name: &str) -> Result<()> {
let toml_path = root.join(format!("{}.toml", name)); let toml_path = root.join(format!("{}.toml", name));
if !toml_path.exists() { if !toml_path.exists() {
return Err(anyhow!("Entry '{}' not found", name)); return Err(anyhow!("Entry '{}' not found", name));
+1 -1
View File
@@ -114,7 +114,7 @@ async fn main() -> anyhow::Result<()> {
.route("/changelog", get(render_changelog_handler)) .route("/changelog", get(render_changelog_handler))
.nest_service( .nest_service(
"/images", "/images",
tower_http::services::ServeDir::new(&shared_state.docs_dir.join("images")), tower_http::services::ServeDir::new(shared_state.docs_dir.join("images")),
) )
.nest_service( .nest_service(
"/assets", "/assets",
+2 -2
View File
@@ -85,7 +85,7 @@ impl<'a> Iterator for Renderer<'a> {
Event::Start(Tag::CodeBlock(kind)) => { Event::Start(Tag::CodeBlock(kind)) => {
let mut code_content = String::new(); let mut code_content = String::new();
while let Some(inner_event) = self.inner.next() { for inner_event in self.inner.by_ref() {
match inner_event { match inner_event {
Event::End(TagEnd::CodeBlock) => break, Event::End(TagEnd::CodeBlock) => break,
Event::Text(code) => code_content.push_str(&code), Event::Text(code) => code_content.push_str(&code),
@@ -111,7 +111,7 @@ impl<'a> Iterator for Renderer<'a> {
); );
Some(Event::Html(CowStr::Boxed(rendered_html.into_boxed_str()))) Some(Event::Html(CowStr::Boxed(rendered_html.into_boxed_str())))
} }
_ => return Some(event), _ => Some(event),
} }
} }
} }