rust-lang / rust-lang/rust-clippy

sort function arguments alphabetically

Open
#16,174 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is identified in the issue. Start by reviewing existing rust-clippy lint implementations and tests to determine how a lint for alphabetically ordered function arguments should fit the project. Done means the ordering rules, exceptions, diagnostics, and expected tests are agreed and implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.