Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

style(web): collapse nested if condition in slugify

Vinícius DS Andrade4308af5ffeb3
diff --git a/crates/ai-memory-web/src/markdown.rs b/crates/ai-memory-web/src/markdown.rs
index c90f6806..7f539518 100644
--- a/crates/ai-memory-web/src/markdown.rs
+++ b/crates/ai-memory-web/src/markdown.rs
@@ -481,11 +481,12 @@ fn slugify(text: &str) -> String {
} else if c == '_' {
slug.push(c);
prev_is_dash = false;
- } else if c == '-' || c == '—' || c == '–' || c.is_whitespace() {
- if !slug.is_empty() && !prev_is_dash {
- slug.push('-');
- prev_is_dash = true;
- }
+ } else if (c == '-' || c == '—' || c == '–' || c.is_whitespace())
+ && !slug.is_empty()
+ && !prev_is_dash
+ {
+ slug.push('-');
+ prev_is_dash = true;
}
}