Back to all reviewers

Use explicit identifiers

nrwl/nx
Based on 2 comments
Rust

Choose explicit, unambiguous names for functions, variables, and parameters to avoid conflicts with common types and reduce reliance on implicit assumptions. Prefer descriptive names that clearly indicate purpose over generic terms that might be confused with built-in types or require string parsing.

Naming Conventions Rust

Reviewer Prompt

Choose explicit, unambiguous names for functions, variables, and parameters to avoid conflicts with common types and reduce reliance on implicit assumptions. Prefer descriptive names that clearly indicate purpose over generic terms that might be confused with built-in types or require string parsing.

For function names, avoid generic terms like error that commonly appear as type instances. Instead, use prefixed names like log_error or logError to clearly indicate the function’s purpose.

For parameters, prefer explicit values over implicit extraction. Rather than parsing identifiers from formatted strings, pass the required values directly as separate parameters.

Example:

// Avoid: Generic name that conflicts with Error type
pub fn error(message: String) { ... }

// Prefer: Explicit, descriptive name
pub fn log_error(message: String) { ... }

// Avoid: Implicit extraction from formatted strings
let project_name = task_id.split(':').next().unwrap_or(task_id);

// Prefer: Explicit parameter passing
fn process_task(task_id: String, project_name: String) { ... }
2
Comments Analyzed
Rust
Primary Language
Naming Conventions
Category

Source Discussions