Skip to content

sort function arguments alphabetically #16174

@amab8901

Description

@amab8901

What it does

it sorts function arguments alphabetically

Advantage

makes it easier to find the argument I'm looking for in the function. Especially useful when I follow the path taken by some variable through the various functions/methods in the program. Or if I just wanna get a high-level overview of which info is passed to the given function without having to worry if I might have missed something. Thus it helps save time.

Drawbacks

idk

Example

fn function(
    d: String,
    b: String,
    h: String,
    g: String,
    e: String,
    f: String,
    c: String,
    a: String,
) {
    println!("{a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}");
}

Could be written as:

fn function(
    a: String,
    b: String,
    c: String,
    d: String,
    e: String,
    f: String,
    g: String,
    h: String,
) {
    println!("{a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}");
}

Comparison with existing lints

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions