Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many_single_char_names incorrectly triggered if 'single-char-binding-names-threshold = 0' #4086

Closed
BafDyce opened this issue May 12, 2019 · 3 comments · Fixed by #5468
Closed
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy

Comments

@BafDyce
Copy link

BafDyce commented May 12, 2019

As I don't want to allow ANY variable names with only one character, I have the following clippy.toml:

single-char-binding-names-threshold = 0

Additionally, I run clippy with -- -D warnings to force myself to write clean & idiomatic code.

However, now clippy (and therefore all my CI jobs) fail with the following error:

$ cargo clippy -- -D warnings
    Checking clippy-issue-single-char-names v0.1.0 (/path/to/clippy-issue-single-char-names)
error: 0 bindings with single-character names in scope
  |
  = note: `-D clippy::many-single-char-names` implied by `-D warnings`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names

error: aborting due to previous error

error: Could not compile `clippy-issue-single-char-names`.

This can also be reproduced by a simple hello-world example, as generated by running cargo new, as demonstrated here:

$ cargo new --bin clippy-issue-single-char-names
     Created binary (application) `clippy-issue-single-char-names` package
$ cd clippy-issue-single-char-names
$ echo 'single-char-binding-names-threshold = 0' > clippy.toml
$ cargo clippy -- -D warnings
    Checking clippy-issue-single-char-names v0.1.0 (/path/to/clippy-issue-single-char-names)
error: 0 bindings with single-character names in scope
  |
  = note: `-D clippy::many-single-char-names` implied by `-D warnings`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names

error: aborting due to previous error

error: Could not compile `clippy-issue-single-char-names`.

To learn more, run the command again with --verbose.

I know that it worked a few months back but I cannot tell you when exactly it stopped working as I haven't programmed in a while..

If I set the value to 1, then clippy does not complain, so I guess there's a wrong >= instead of just > somewhere..

clippy version:

$ cargo clippy -V
clippy 0.0.212 (3710ec5 2019-05-11)

Edit/Note: I can't reproduce this if I clone rust-clippy and run clippy from this repository, so maybe/probably this was already fixed since the last release?

@phansch phansch self-assigned this May 12, 2019
@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label May 12, 2019
@oli-obk oli-obk added A-musing good-first-issue These issues are a good way to get started with Clippy labels May 12, 2019
bors added a commit that referenced this issue May 12, 2019
UI test cleanup: Extract many_single_char_names tests

changelog: none

cc #2038, #4086
bors added a commit that referenced this issue May 12, 2019
UI test cleanup: Extract many_single_char_names tests

changelog: none

cc #2038, #4086
bors added a commit that referenced this issue May 12, 2019
UI test cleanup: Extract many_single_char_names tests

changelog: none

cc #2038, #4086
@phansch phansch removed their assignment May 12, 2019
@marcin-serwin
Copy link
Contributor

marcin-serwin commented Apr 15, 2020

Hi, Could I take a look at this issue?

@phansch
Copy link
Member

phansch commented Apr 15, 2020

@Toxyxer sure, go ahead =)

@marcin-serwin
Copy link
Contributor

Hey @phansch,
I think I have fixed the issue in the PR, but the build fails because of the new rust nightly version (DUMMY_HIR_ID was removed in this commit). Can I do something about it or should I wait until clippy is updated and rerun the PR build?

@bors bors closed this as completed in 19183a6 Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants