@@ -10,11 +10,10 @@ use rustc_errors::Applicability;
10
10
use rustc_hir:: {
11
11
Block , Expr , ExprKind , ImplItem , ImplItemKind , Item , ItemKind , StmtKind , TraitFn , TraitItem , TraitItemKind ,
12
12
} ;
13
- use rustc_lint:: { CheckLintNameResult , EarlyContext , EarlyLintPass , LateContext , LateLintPass , LintContext } ;
13
+ use rustc_lint:: { EarlyContext , EarlyLintPass , LateContext , LateLintPass , LintContext } ;
14
14
use rustc_middle:: lint:: in_external_macro;
15
15
use rustc_middle:: ty;
16
16
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
17
- use rustc_span:: lev_distance:: find_best_match_for_name;
18
17
use rustc_span:: source_map:: Span ;
19
18
use rustc_span:: sym;
20
19
use rustc_span:: symbol:: { Symbol , SymbolStr } ;
@@ -156,33 +155,6 @@ declare_clippy_lint! {
156
155
"empty line after outer attribute"
157
156
}
158
157
159
- declare_clippy_lint ! {
160
- /// **What it does:** Checks for `allow`/`warn`/`deny`/`forbid` attributes with scoped clippy
161
- /// lints and if those lints exist in clippy. If there is an uppercase letter in the lint name
162
- /// (not the tool name) and a lowercase version of this lint exists, it will suggest to lowercase
163
- /// the lint name.
164
- ///
165
- /// **Why is this bad?** A lint attribute with a mistyped lint name won't have an effect.
166
- ///
167
- /// **Known problems:** None.
168
- ///
169
- /// **Example:**
170
- /// Bad:
171
- /// ```rust
172
- /// #![warn(if_not_els)]
173
- /// #![deny(clippy::All)]
174
- /// ```
175
- ///
176
- /// Good:
177
- /// ```rust
178
- /// #![warn(if_not_else)]
179
- /// #![deny(clippy::all)]
180
- /// ```
181
- pub UNKNOWN_CLIPPY_LINTS ,
182
- style,
183
- "unknown_lints for scoped Clippy lints"
184
- }
185
-
186
158
declare_clippy_lint ! {
187
159
/// **What it does:** Checks for `warn`/`deny`/`forbid` attributes targeting the whole clippy::restriction category.
188
160
///
@@ -272,7 +244,6 @@ declare_lint_pass!(Attributes => [
272
244
INLINE_ALWAYS ,
273
245
DEPRECATED_SEMVER ,
274
246
USELESS_ATTRIBUTE ,
275
- UNKNOWN_CLIPPY_LINTS ,
276
247
BLANKET_CLIPPY_RESTRICTION_LINTS ,
277
248
] ) ;
278
249
@@ -409,48 +380,9 @@ fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<SymbolStr> {
409
380
}
410
381
411
382
fn check_clippy_lint_names ( cx : & LateContext < ' _ > , ident : & str , items : & [ NestedMetaItem ] ) {
412
- let lint_store = cx. lints ( ) ;
413
383
for lint in items {
414
384
if let Some ( lint_name) = extract_clippy_lint ( lint) {
415
- if let CheckLintNameResult :: Tool ( Err ( ( None , _) ) ) = lint_store. check_lint_name ( & lint_name, Some ( sym:: clippy) )
416
- {
417
- span_lint_and_then (
418
- cx,
419
- UNKNOWN_CLIPPY_LINTS ,
420
- lint. span ( ) ,
421
- & format ! ( "unknown clippy lint: clippy::{}" , lint_name) ,
422
- |diag| {
423
- let name_lower = lint_name. to_lowercase ( ) ;
424
- let symbols = lint_store
425
- . get_lints ( )
426
- . iter ( )
427
- . map ( |l| Symbol :: intern ( & l. name_lower ( ) ) )
428
- . collect :: < Vec < _ > > ( ) ;
429
- let sugg = find_best_match_for_name (
430
- & symbols,
431
- Symbol :: intern ( & format ! ( "clippy::{}" , name_lower) ) ,
432
- None ,
433
- ) ;
434
- if lint_name. chars ( ) . any ( char:: is_uppercase)
435
- && lint_store. find_lints ( & format ! ( "clippy::{}" , name_lower) ) . is_ok ( )
436
- {
437
- diag. span_suggestion (
438
- lint. span ( ) ,
439
- "lowercase the lint name" ,
440
- format ! ( "clippy::{}" , name_lower) ,
441
- Applicability :: MachineApplicable ,
442
- ) ;
443
- } else if let Some ( sugg) = sugg {
444
- diag. span_suggestion (
445
- lint. span ( ) ,
446
- "did you mean" ,
447
- sugg. to_string ( ) ,
448
- Applicability :: MachineApplicable ,
449
- ) ;
450
- }
451
- } ,
452
- ) ;
453
- } else if lint_name == "restriction" && ident != "allow" {
385
+ if lint_name == "restriction" && ident != "allow" {
454
386
span_lint_and_help (
455
387
cx,
456
388
BLANKET_CLIPPY_RESTRICTION_LINTS ,
0 commit comments