-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New lint: Unknown clippy lints #3161
Changes from all commits
f6d5786
8d516b3
6819127
ea4a80f
cf89c40
014cf3d
4e1102f
faa1db3
32396f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this test also the old There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend to explicitly write a lint for The problem is, that it's impossible to lint crate-level |
||
#![allow(clippy::All)] | ||
#![warn(clippy::pedantic)] | ||
|
||
#[warn(clippy::if_not_els)] | ||
fn main() { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: unknown clippy lint: clippy::if_not_els | ||
--> $DIR/unknown_clippy_lints.rs:13:8 | ||
| | ||
13 | #[warn(clippy::if_not_els)] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::unknown-clippy-lints` implied by `-D warnings` | ||
|
||
error: unknown clippy lint: clippy::All | ||
--> $DIR/unknown_clippy_lints.rs:10:10 | ||
| | ||
10 | #![allow(clippy::All)] | ||
| ^^^^^^^^^^^ help: lowercase the lint name: `all` | ||
|
||
error: aborting due to 2 previous errors | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing there's currently no way to manually iterate the list and do a levensthein search for close matches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. This is the behavior of the
unknown_lints
lint of the compiler. This could be an enhancement for this lint AND the compiler lint. (I'm not sure if the performance of this would be bad though)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have some tricks like checking whether a lint is allowed before doing the heavy work. But yea, we should fix this in the compiler first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
lev_distance
in the compiler.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened rust-lang/rust#54737 for improving the rustc
unknown_lints
suggestion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure when I get around to work on Rust's unknown_lints, I'm fine with merging this and creating an issue to improve the suggestions later on.