Skip to content

Improve too_many_arguments: only highlight function arguments instead of entire function #2488

Closed
@alexheretic

Description

@alexheretic

Too many arguments lint highlights the entire function which can end up being quite visually noisey. It would be nicer to highlight the arguments / lines with arguments in them or similar.

fn foo(_: u8, _: u8, _: u8, _: u8, _: u8, _: u8, _: u8, _: u8) {
    let _prefectly = "tarred";
    let _fine = "with";
    let _code = "same";
    let _is = "brush";
}
fn main() {
    foo(1, 2, 3, 4, 5, 6, 7, 8);
}

atom ide-rust

warning: this function has too many arguments (8/7)
 --> src/main.rs:1:1
  |
1 | / fn foo(_: u8, _: u8, _: u8, _: u8, _: u8, _: u8, _: u8, _: u8) {
2 | |     let _prefectly = "tarred";
3 | |     let _fine = "with";
4 | |     let _code = "same";
5 | |     let _is = "brush";
6 | | }
  | |_^
  |
  = note: #[warn(too_many_arguments)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.186/index.html#too_many_arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions