Back to all reviewers

Names reveal clear intent

pola-rs/polars
Based on 6 comments
Rust

Choose names that clearly communicate intent and context, avoiding ambiguity or confusion. Variable and function names should be self-documenting and reflect their domain purpose.

Naming Conventions Rust

Reviewer Prompt

Choose names that clearly communicate intent and context, avoiding ambiguity or confusion. Variable and function names should be self-documenting and reflect their domain purpose.

Key guidelines:

  • Use domain-specific terminology consistently
  • Prefer descriptive names over generic ones
  • Make implicit context explicit in the name
  • Avoid positional/numeric references in favor of semantic names

Example - Before:

fn make_categoricals_compatible(
    input: &[column],  // Uses numeric index input[1]
    array_width: usize,
) 

After:

fn make_rhs_categoricals_compatible(
    CategoryMapping {
        source_column,
        target_column,
    }: CategoryMapping,
    array_width_in_bytes: usize,
)

The improved version:

  • Clarifies the function’s effect on right-hand side
  • Uses a semantic structure instead of array indices
  • Adds context to the width parameter
  • Makes the relationship between parameters explicit
6
Comments Analyzed
Rust
Primary Language
Naming Conventions
Category

Source Discussions