Prompt
Favor concise and idiomatic expressions in your Rust code to improve readability and maintainability. Specifically:
- Use Rust’s expressive methods instead of verbose alternatives
// Prefer this ident_ref.query.owned().await? // Instead of this (*ident_ref.query.await?).clone() - Avoid redundant
.to_string()calls informat!arguments when the type already implementsDisplay// Prefer this format!("Check {} and {}", this.page, this.other_page) // Instead of this format!("Check {} and {}", this.page.to_string(), this.other_page.to_string()) - Only derive the traits you actually need, removing unnecessary derives like
serde::Serializeandserde::Deserializewhen they’re not used// Prefer this #[derive(Debug, Clone, Eq, PartialEq, Hash)] // Instead of this when serialization isn't needed #[derive(Debug, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)]
These practices reduce visual noise and make the intent of your code clearer.