Skip to content

Commit

Permalink
fix(frontmatter-gen): 🐛 Replace unnecessary to_string and optimize …
Browse files Browse the repository at this point in the history
…key checks

- Replaced `to_string` calls with direct string literals in `HashMap::get` and `contains_key`. - Updated tests to use `contains_key` instead of `get(...).is_none()`. - Optimized assertions to follow idiomatic Rust patterns. - Ensured Clippy compliance for the `unnecessary_to_owned` and `unnecessary_get_then_check` lints.
  • Loading branch information
sebastienrousseau committed Nov 23, 2024
1 parent 7bf5ce4 commit 750f6c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ mod tests {

let templates = engine.template_cache.read().await;
assert_eq!(
templates.items.get(&"default".to_string()),
templates.items.get("default"),
Some(&template_content.to_string())
);

Expand All @@ -500,7 +500,7 @@ mod tests {
engine.load_templates(&config).await?;

let templates = engine.template_cache.read().await;
assert!(templates.items.get(&"invalid".to_string()).is_none());
assert!(!templates.items.contains_key("invalid"));
Ok(())
}

Expand Down

0 comments on commit 750f6c0

Please sign in to comment.