@@ -10,11 +10,10 @@ use rustc_errors::Applicability;
1010use rustc_hir:: {
1111 Block , Expr , ExprKind , ImplItem , ImplItemKind , Item , ItemKind , StmtKind , TraitFn , TraitItem , TraitItemKind ,
1212} ;
13- use rustc_lint:: { CheckLintNameResult , EarlyContext , EarlyLintPass , LateContext , LateLintPass , LintContext } ;
13+ use rustc_lint:: { EarlyContext , EarlyLintPass , LateContext , LateLintPass , LintContext } ;
1414use rustc_middle:: lint:: in_external_macro;
1515use rustc_middle:: ty;
1616use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
17- use rustc_span:: lev_distance:: find_best_match_for_name;
1817use rustc_span:: source_map:: Span ;
1918use rustc_span:: sym;
2019use rustc_span:: symbol:: { Symbol , SymbolStr } ;
@@ -156,33 +155,6 @@ declare_clippy_lint! {
156155 "empty line after outer attribute"
157156}
158157
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-
186158declare_clippy_lint ! {
187159 /// **What it does:** Checks for `warn`/`deny`/`forbid` attributes targeting the whole clippy::restriction category.
188160 ///
@@ -272,7 +244,6 @@ declare_lint_pass!(Attributes => [
272244 INLINE_ALWAYS ,
273245 DEPRECATED_SEMVER ,
274246 USELESS_ATTRIBUTE ,
275- UNKNOWN_CLIPPY_LINTS ,
276247 BLANKET_CLIPPY_RESTRICTION_LINTS ,
277248] ) ;
278249
@@ -409,48 +380,9 @@ fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<SymbolStr> {
409380}
410381
411382fn check_clippy_lint_names ( cx : & LateContext < ' _ > , ident : & str , items : & [ NestedMetaItem ] ) {
412- let lint_store = cx. lints ( ) ;
413383 for lint in items {
414384 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" {
454386 span_lint_and_help (
455387 cx,
456388 BLANKET_CLIPPY_RESTRICTION_LINTS ,
0 commit comments