Choose clear, descriptive names over abbreviated or shortened versions. Names should be self-documenting and follow Rust conventions. While brevity can be tempting, the clarity and maintainability benefits of descriptive names outweigh the extra characters.
Choose clear, descriptive names over abbreviated or shortened versions. Names should be self-documenting and follow Rust conventions. While brevity can be tempting, the clarity and maintainability benefits of descriptive names outweigh the extra characters.
Good practices:
Example:
// Instead of:
use axum::http::StatusCode as SC;
const HTML: &str = "text/html";
struct User { _id: u32 }
// Prefer:
use axum::http::StatusCode;
const CONTENT_TYPE_HTML: &str = "text/html";
struct User {
#[serde(rename = "_id")] // maintains MongoDB convention while using Rust style
id: u32
}
Enter the URL of a public GitHub repository