Skip to content

Add variable naming section on expressing unit of the type #9

@faern

Description

@faern

If a type does not include the unit of the value, the variable name has to. Otherwise it becomes hard to know what is what.

// The type expresses the unit. Best solution.
let interval: Duration = Duration::from_millis(1001);

// The variable expresses the unit. Good solution for when the type can't or should not express the unit.
let interval_ms: u64 = 1001;

// Neither expresses the unit. Very hard to read, understand and properly use:
let interval: u64 = 1001;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions