Skip to content

Strange behavior from similar_names in most recent clippy version #2927

Closed
@sgrif

Description

@sgrif

I'm updating Diesel to the most recent nightly for our tests. This issue occurred with rustup component add clippy-preview on the most recent nightly (rustc 1.29.0-nightly (1ecf6929d 2018-07-16)).

When running cargo clippy on our code base, I receive the following error:


error: binding's name is too similar to existing binding
  |
note: existing binding defined here
 --> diesel_cli/src/main.rs:121:27
  |
12|         ("generate", Some(args)) => {
  |                           ^^^^
help: separate the discriminating character by an underscore like: `arg_1`
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#similar_names

error: binding's name is too similar to existing binding
  |
note: existing binding defined here
 --> diesel_cli/src/main.rs:121:27
  |
12|         ("generate", Some(args)) => {
  |                           ^^^^
help: separate the discriminating character by an underscore like: `arg_0`
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#similar_names

The first point of note is that it doesn't seem to be pointing to the line that is causing the error, the only span it's showing is in the note section for the existing binding. The second problem is that it's just pointing to the same line multiple times. There is no binding in scope at all close to args other than that one, so it seems to think that the name is too similar to itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions