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

This commit is contained in:
2026-06-03 09:48:47 +02:00
parent 81d775a7dd
commit 09b1600779
5 changed files with 23 additions and 22 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ impl WikiGraph {
);
}
println!("");
println!();
// Edges
for (source, targets) in &self.edges {
+12 -11
View File
@@ -106,11 +106,12 @@ async fn update_from_git(changelog_path: &Path, git_dir: &Path, wiki_root: &Path
for line in stdout.lines() {
if line.starts_with("---ENTRY---|") {
// Push previous
if let Some(entry) = current_entry.take() {
if !entry.files.is_empty() && !existing_hashes.contains(&entry.hash) {
if let Some(entry) = current_entry.take()
&& !entry.files.is_empty()
&& !existing_hashes.contains(&entry.hash)
{
new_entries.push(entry);
}
}
// Parse new
let parts: Vec<&str> = line.split('|').collect();
@@ -153,11 +154,12 @@ async fn update_from_git(changelog_path: &Path, git_dir: &Path, wiki_root: &Path
}
// Push last
if let Some(entry) = current_entry {
if !entry.files.is_empty() && !existing_hashes.contains(&entry.hash) {
if let Some(entry) = current_entry
&& !entry.files.is_empty()
&& !existing_hashes.contains(&entry.hash)
{
new_entries.push(entry);
}
}
if new_entries.is_empty() {
println!("No new commits touching the wiki directory found.");
@@ -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> {
let path = root_dir.join("_changelog.toml");
if path.exists() {
if let Ok(content) = fs::read_to_string(path).await {
if let Ok(config) = toml::from_str::<ChangelogConfig>(&content) {
if path.exists()
&& let Ok(content) = fs::read_to_string(path).await
&& let Ok(config) = toml::from_str::<ChangelogConfig>(&content)
{
return config.entries;
}
}
}
Vec::new()
}
+4 -4
View File
@@ -59,7 +59,7 @@ async fn list_entries(root: &PathBuf) -> Result<()> {
Ok(())
}
fn check_file_status(root: &PathBuf, filename: Option<String>) -> String {
fn check_file_status(root: &Path, filename: Option<String>) -> String {
match filename {
Some(f) => {
let path = root.join("images").join(&f);
@@ -73,7 +73,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
.trim()
.to_lowercase()
@@ -139,7 +139,7 @@ content_file = "{}"
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));
if !toml_path.exists() {
@@ -176,7 +176,7 @@ async fn remove_entry(root: &PathBuf, name: &str) -> Result<()> {
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));
if !toml_path.exists() {
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))
.nest_service(
"/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(
"/assets",
+2 -2
View File
@@ -85,7 +85,7 @@ impl<'a> Iterator for Renderer<'a> {
Event::Start(Tag::CodeBlock(kind)) => {
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 {
Event::End(TagEnd::CodeBlock) => break,
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())))
}
_ => return Some(event),
_ => Some(event),
}
}
}