Replace - with _ in generated lint names

This commit is contained in:
Lukas Wirth 2021-06-04 19:03:45 +02:00
parent 0b9ba4977e
commit 0c89f38378
3 changed files with 151 additions and 150 deletions

View file

@ -123,6 +123,7 @@ pub(crate) fn hover(
_ => { _ => {
if ast::Comment::cast(token.clone()).is_some() { if ast::Comment::cast(token.clone()).is_some() {
cov_mark::hit!(no_highlight_on_comment_hover);
let (attributes, def) = doc_attributes(&sema, &node)?; let (attributes, def) = doc_attributes(&sema, &node)?;
let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?;
let (idl_range, link, ns) = let (idl_range, link, ns) =
@ -136,8 +137,10 @@ pub(crate) fn hover(
})?; })?;
range = Some(idl_range); range = Some(idl_range);
resolve_doc_path_for_def(db, def, &link, ns).map(Definition::ModuleDef) resolve_doc_path_for_def(db, def, &link, ns).map(Definition::ModuleDef)
} else if let res@Some(_) = try_hover_for_attribute(&token) {
return res;
} else { } else {
return try_hover_for_attribute(&token); None
} }
}, },
} }
@ -169,11 +172,6 @@ pub(crate) fn hover(
} }
} }
if token.kind() == syntax::SyntaxKind::COMMENT {
cov_mark::hit!(no_highlight_on_comment_hover);
return None;
}
if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, &token) { if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, &token) {
return res; return res;
} }

View file

@ -6,384 +6,382 @@ pub struct Lint {
} }
pub const DEFAULT_LINTS: &[Lint] = &[ pub const DEFAULT_LINTS: &[Lint] = &[
Lint { label: "----", description: r##"-------"## },
Lint { label: "----", description: r##"lint group for: ---------"## },
Lint { Lint {
label: "absolute-paths-not-starting-with-crate", label: "absolute_paths_not_starting_with_crate",
description: r##"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"##, description: r##"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"##,
}, },
Lint { label: "ambiguous-associated-items", description: r##"ambiguous associated items"## }, Lint { label: "ambiguous_associated_items", description: r##"ambiguous associated items"## },
Lint { label: "anonymous-parameters", description: r##"detects anonymous parameters"## }, Lint { label: "anonymous_parameters", description: r##"detects anonymous parameters"## },
Lint { label: "arithmetic-overflow", description: r##"arithmetic operation overflows"## }, Lint { label: "arithmetic_overflow", description: r##"arithmetic operation overflows"## },
Lint { label: "array-into-iter", description: r##"detects calling `into_iter` on arrays"## }, Lint { label: "array_into_iter", description: r##"detects calling `into_iter` on arrays"## },
Lint { Lint {
label: "asm-sub-register", label: "asm_sub_register",
description: r##"using only a subset of a register for inline asm inputs"##, description: r##"using only a subset of a register for inline asm inputs"##,
}, },
Lint { label: "bad-asm-style", description: r##"incorrect use of inline assembly"## }, Lint { label: "bad_asm_style", description: r##"incorrect use of inline assembly"## },
Lint { Lint {
label: "bare-trait-objects", label: "bare_trait_objects",
description: r##"suggest using `dyn Trait` for trait objects"##, description: r##"suggest using `dyn Trait` for trait objects"##,
}, },
Lint { Lint {
label: "bindings-with-variant-name", label: "bindings_with_variant_name",
description: r##"detects pattern bindings with the same name as one of the matched variants"##, description: r##"detects pattern bindings with the same name as one of the matched variants"##,
}, },
Lint { label: "box-pointers", description: r##"use of owned (Box type) heap memory"## }, Lint { label: "box_pointers", description: r##"use of owned (Box type) heap memory"## },
Lint { Lint {
label: "cenum-impl-drop-cast", label: "cenum_impl_drop_cast",
description: r##"a C-like enum implementing Drop is cast"##, description: r##"a C-like enum implementing Drop is cast"##,
}, },
Lint { Lint {
label: "clashing-extern-declarations", label: "clashing_extern_declarations",
description: r##"detects when an extern fn has been declared with the same name but different types"##, description: r##"detects when an extern fn has been declared with the same name but different types"##,
}, },
Lint { Lint {
label: "coherence-leak-check", label: "coherence_leak_check",
description: r##"distinct impls distinguished only by the leak-check code"##, description: r##"distinct impls distinguished only by the leak-check code"##,
}, },
Lint { Lint {
label: "conflicting-repr-hints", label: "conflicting_repr_hints",
description: r##"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"##, description: r##"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"##,
}, },
Lint { Lint {
label: "confusable-idents", label: "confusable_idents",
description: r##"detects visually confusable pairs between identifiers"##, description: r##"detects visually confusable pairs between identifiers"##,
}, },
Lint { Lint {
label: "const-err", label: "const_err",
description: r##"constant evaluation encountered erroneous expression"##, description: r##"constant evaluation encountered erroneous expression"##,
}, },
Lint { Lint {
label: "const-evaluatable-unchecked", label: "const_evaluatable_unchecked",
description: r##"detects a generic constant is used in a type without a emitting a warning"##, description: r##"detects a generic constant is used in a type without a emitting a warning"##,
}, },
Lint { Lint {
label: "const-item-mutation", label: "const_item_mutation",
description: r##"detects attempts to mutate a `const` item"##, description: r##"detects attempts to mutate a `const` item"##,
}, },
Lint { label: "dead-code", description: r##"detect unused, unexported items"## }, Lint { label: "dead_code", description: r##"detect unused, unexported items"## },
Lint { label: "deprecated", description: r##"detects use of deprecated items"## }, Lint { label: "deprecated", description: r##"detects use of deprecated items"## },
Lint { Lint {
label: "deprecated-in-future", label: "deprecated_in_future",
description: r##"detects use of items that will be deprecated in a future version"##, description: r##"detects use of items that will be deprecated in a future version"##,
}, },
Lint { Lint {
label: "deref-nullptr", label: "deref_nullptr",
description: r##"detects when an null pointer is dereferenced"##, description: r##"detects when an null pointer is dereferenced"##,
}, },
Lint { Lint {
label: "disjoint-capture-migration", label: "disjoint_capture_migration",
description: r##"Drop reorder and auto traits error because of `capture_disjoint_fields`"##, description: r##"Drop reorder and auto traits error because of `capture_disjoint_fields`"##,
}, },
Lint { label: "drop-bounds", description: r##"bounds of the form `T: Drop` are useless"## }, Lint { label: "drop_bounds", description: r##"bounds of the form `T: Drop` are useless"## },
Lint { Lint {
label: "elided-lifetimes-in-paths", label: "elided_lifetimes_in_paths",
description: r##"hidden lifetime parameters in types are deprecated"##, description: r##"hidden lifetime parameters in types are deprecated"##,
}, },
Lint { Lint {
label: "ellipsis-inclusive-range-patterns", label: "ellipsis_inclusive_range_patterns",
description: r##"`...` range patterns are deprecated"##, description: r##"`...` range patterns are deprecated"##,
}, },
Lint { Lint {
label: "explicit-outlives-requirements", label: "explicit_outlives_requirements",
description: r##"outlives requirements can be inferred"##, description: r##"outlives requirements can be inferred"##,
}, },
Lint { Lint {
label: "exported-private-dependencies", label: "exported_private_dependencies",
description: r##"public interface leaks type from a private dependency"##, description: r##"public interface leaks type from a private dependency"##,
}, },
Lint { label: "forbidden-lint-groups", description: r##"applying forbid to lint-groups"## }, Lint { label: "forbidden_lint_groups", description: r##"applying forbid to lint-groups"## },
Lint { Lint {
label: "function-item-references", label: "function_item_references",
description: r##"suggest casting to a function pointer when attempting to take references to function items"##, description: r##"suggest casting to a function pointer when attempting to take references to function items"##,
}, },
Lint { Lint {
label: "future-incompatible", label: "future_incompatible",
description: r##"lint group for: keyword-idents, anonymous-parameters, ellipsis-inclusive-range-patterns, forbidden-lint-groups, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, const-err, unaligned-references, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, bare-trait-objects, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, pointer-structural-match, nontrivial-structural-match, soft-unstable, cenum-impl-drop-cast, const-evaluatable-unchecked, uninhabited-static, unsupported-naked-functions, semicolon-in-expressions-from-macros, legacy-derive-helpers, proc-macro-back-compat, array-into-iter"##, description: r##"lint group for: keyword-idents, anonymous-parameters, ellipsis-inclusive-range-patterns, forbidden-lint-groups, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, const-err, unaligned-references, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, bare-trait-objects, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, pointer-structural-match, nontrivial-structural-match, soft-unstable, cenum-impl-drop-cast, const-evaluatable-unchecked, uninhabited-static, unsupported-naked-functions, semicolon-in-expressions-from-macros, legacy-derive-helpers, proc-macro-back-compat, array-into-iter"##,
}, },
Lint { Lint {
label: "ill-formed-attribute-input", label: "ill_formed_attribute_input",
description: r##"ill-formed attribute inputs that were previously accepted and used in practice"##, description: r##"ill-formed attribute inputs that were previously accepted and used in practice"##,
}, },
Lint { Lint {
label: "illegal-floating-point-literal-pattern", label: "illegal_floating_point_literal_pattern",
description: r##"floating-point literals cannot be used in patterns"##, description: r##"floating-point literals cannot be used in patterns"##,
}, },
Lint { Lint {
label: "improper-ctypes", label: "improper_ctypes",
description: r##"proper use of libc types in foreign modules"##, description: r##"proper use of libc types in foreign modules"##,
}, },
Lint { Lint {
label: "improper-ctypes-definitions", label: "improper_ctypes_definitions",
description: r##"proper use of libc types in foreign item definitions"##, description: r##"proper use of libc types in foreign item definitions"##,
}, },
Lint { Lint {
label: "incomplete-features", label: "incomplete_features",
description: r##"incomplete features that may function improperly in some or all cases"##, description: r##"incomplete features that may function improperly in some or all cases"##,
}, },
Lint { label: "incomplete-include", description: r##"trailing content in included file"## }, Lint { label: "incomplete_include", description: r##"trailing content in included file"## },
Lint { Lint {
label: "indirect-structural-match", label: "indirect_structural_match",
description: r##"constant used in pattern contains value of non-structural-match type in a field or a variant"##, description: r##"constant used in pattern contains value of non-structural-match type in a field or a variant"##,
}, },
Lint { Lint {
label: "ineffective-unstable-trait-impl", label: "ineffective_unstable_trait_impl",
description: r##"detects `#[unstable]` on stable trait implementations for stable types"##, description: r##"detects `#[unstable]` on stable trait implementations for stable types"##,
}, },
Lint { Lint {
label: "inline-no-sanitize", label: "inline_no_sanitize",
description: r##"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"##, description: r##"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"##,
}, },
Lint { Lint {
label: "invalid-type-param-default", label: "invalid_type_param_default",
description: r##"type parameter default erroneously allowed in invalid location"##, description: r##"type parameter default erroneously allowed in invalid location"##,
}, },
Lint { Lint {
label: "invalid-value", label: "invalid_value",
description: r##"an invalid value is being created (such as a null reference)"##, description: r##"an invalid value is being created (such as a null reference)"##,
}, },
Lint { Lint {
label: "irrefutable-let-patterns", label: "irrefutable_let_patterns",
description: r##"detects irrefutable patterns in `if let` and `while let` statements"##, description: r##"detects irrefutable patterns in `if let` and `while let` statements"##,
}, },
Lint { Lint {
label: "keyword-idents", label: "keyword_idents",
description: r##"detects edition keywords being used as an identifier"##, description: r##"detects edition keywords being used as an identifier"##,
}, },
Lint { label: "large-assignments", description: r##"detects large moves or copies"## }, Lint { label: "large_assignments", description: r##"detects large moves or copies"## },
Lint { Lint {
label: "late-bound-lifetime-arguments", label: "late_bound_lifetime_arguments",
description: r##"detects generic lifetime arguments in path segments with late bound lifetime parameters"##, description: r##"detects generic lifetime arguments in path segments with late bound lifetime parameters"##,
}, },
Lint { Lint {
label: "legacy-derive-helpers", label: "legacy_derive_helpers",
description: r##"detects derive helper attributes that are used before they are introduced"##, description: r##"detects derive helper attributes that are used before they are introduced"##,
}, },
Lint { Lint {
label: "macro-expanded-macro-exports-accessed-by-absolute-paths", label: "macro_expanded_macro_exports_accessed_by_absolute_paths",
description: r##"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"##, description: r##"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"##,
}, },
Lint { Lint {
label: "macro-use-extern-crate", label: "macro_use_extern_crate",
description: r##"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"##, description: r##"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"##,
}, },
Lint { Lint {
label: "meta-variable-misuse", label: "meta_variable_misuse",
description: r##"possible meta-variable misuse at macro definition"##, description: r##"possible meta-variable misuse at macro definition"##,
}, },
Lint { label: "missing-abi", description: r##"No declared ABI for extern declaration"## }, Lint { label: "missing_abi", description: r##"No declared ABI for extern declaration"## },
Lint { Lint {
label: "missing-copy-implementations", label: "missing_copy_implementations",
description: r##"detects potentially-forgotten implementations of `Copy`"##, description: r##"detects potentially-forgotten implementations of `Copy`"##,
}, },
Lint { Lint {
label: "missing-debug-implementations", label: "missing_debug_implementations",
description: r##"detects missing implementations of Debug"##, description: r##"detects missing implementations of Debug"##,
}, },
Lint { Lint {
label: "missing-docs", label: "missing_docs",
description: r##"detects missing documentation for public members"##, description: r##"detects missing documentation for public members"##,
}, },
Lint { Lint {
label: "missing-fragment-specifier", label: "missing_fragment_specifier",
description: r##"detects missing fragment specifiers in unused `macro_rules!` patterns"##, description: r##"detects missing fragment specifiers in unused `macro_rules!` patterns"##,
}, },
Lint { Lint {
label: "mixed-script-confusables", label: "mixed_script_confusables",
description: r##"detects Unicode scripts whose mixed script confusables codepoints are solely used"##, description: r##"detects Unicode scripts whose mixed script confusables codepoints are solely used"##,
}, },
Lint { Lint {
label: "mutable-borrow-reservation-conflict", label: "mutable_borrow_reservation_conflict",
description: r##"reservation of a two-phased borrow conflicts with other shared borrows"##, description: r##"reservation of a two-phased borrow conflicts with other shared borrows"##,
}, },
Lint { Lint {
label: "mutable-transmutes", label: "mutable_transmutes",
description: r##"mutating transmuted &mut T from &T may cause undefined behavior"##, description: r##"mutating transmuted &mut T from &T may cause undefined behavior"##,
}, },
Lint { Lint {
label: "no-mangle-const-items", label: "no_mangle_const_items",
description: r##"const items will not have their symbols exported"##, description: r##"const items will not have their symbols exported"##,
}, },
Lint { label: "no-mangle-generic-items", description: r##"generic items must be mangled"## }, Lint { label: "no_mangle_generic_items", description: r##"generic items must be mangled"## },
Lint { label: "non-ascii-idents", description: r##"detects non-ASCII identifiers"## }, Lint { label: "non_ascii_idents", description: r##"detects non-ASCII identifiers"## },
Lint { Lint {
label: "non-camel-case-types", label: "non_camel_case_types",
description: r##"types, variants, traits and type parameters should have camel case names"##, description: r##"types, variants, traits and type parameters should have camel case names"##,
}, },
Lint { Lint {
label: "non-fmt-panic", label: "non_fmt_panic",
description: r##"detect single-argument panic!() invocations in which the argument is not a format string"##, description: r##"detect single-argument panic!() invocations in which the argument is not a format string"##,
}, },
Lint { Lint {
label: "non-shorthand-field-patterns", label: "non_shorthand_field_patterns",
description: r##"using `Struct { x: x }` instead of `Struct { x }` in a pattern"##, description: r##"using `Struct { x: x }` instead of `Struct { x }` in a pattern"##,
}, },
Lint { Lint {
label: "non-snake-case", label: "non_snake_case",
description: r##"variables, methods, functions, lifetime parameters and modules should have snake case names"##, description: r##"variables, methods, functions, lifetime parameters and modules should have snake case names"##,
}, },
Lint { Lint {
label: "non-upper-case-globals", label: "non_upper_case_globals",
description: r##"static constants should have uppercase identifiers"##, description: r##"static constants should have uppercase identifiers"##,
}, },
Lint { Lint {
label: "nonstandard-style", label: "nonstandard_style",
description: r##"lint group for: non-camel-case-types, non-snake-case, non-upper-case-globals"##, description: r##"lint group for: non-camel-case-types, non-snake-case, non-upper-case-globals"##,
}, },
Lint { Lint {
label: "nontrivial-structural-match", label: "nontrivial_structural_match",
description: r##"constant used in pattern of non-structural-match type and the constant's initializer expression contains values of non-structural-match types"##, description: r##"constant used in pattern of non-structural-match type and the constant's initializer expression contains values of non-structural-match types"##,
}, },
Lint { Lint {
label: "noop-method-call", label: "noop_method_call",
description: r##"detects the use of well-known noop methods"##, description: r##"detects the use of well-known noop methods"##,
}, },
Lint { Lint {
label: "or-patterns-back-compat", label: "or_patterns_back_compat",
description: r##"detects usage of old versions of or-patterns"##, description: r##"detects usage of old versions of or-patterns"##,
}, },
Lint { Lint {
label: "order-dependent-trait-objects", label: "order_dependent_trait_objects",
description: r##"trait-object types were treated as different depending on marker-trait order"##, description: r##"trait-object types were treated as different depending on marker-trait order"##,
}, },
Lint { label: "overflowing-literals", description: r##"literal out of range for its type"## }, Lint { label: "overflowing_literals", description: r##"literal out of range for its type"## },
Lint { Lint {
label: "overlapping-range-endpoints", label: "overlapping_range_endpoints",
description: r##"detects range patterns with overlapping endpoints"##, description: r##"detects range patterns with overlapping endpoints"##,
}, },
Lint { label: "path-statements", description: r##"path statements with no effect"## }, Lint { label: "path_statements", description: r##"path statements with no effect"## },
Lint { Lint {
label: "patterns-in-fns-without-body", label: "patterns_in_fns_without_body",
description: r##"patterns in functions without body were erroneously allowed"##, description: r##"patterns in functions without body were erroneously allowed"##,
}, },
Lint { Lint {
label: "pointer-structural-match", label: "pointer_structural_match",
description: r##"pointers are not structural-match"##, description: r##"pointers are not structural-match"##,
}, },
Lint { Lint {
label: "private-in-public", label: "private_in_public",
description: r##"detect private items in public interfaces not caught by the old implementation"##, description: r##"detect private items in public interfaces not caught by the old implementation"##,
}, },
Lint { Lint {
label: "proc-macro-back-compat", label: "proc_macro_back_compat",
description: r##"detects usage of old versions of certain proc-macro crates"##, description: r##"detects usage of old versions of certain proc-macro crates"##,
}, },
Lint { Lint {
label: "proc-macro-derive-resolution-fallback", label: "proc_macro_derive_resolution_fallback",
description: r##"detects proc macro derives using inaccessible names from parent modules"##, description: r##"detects proc macro derives using inaccessible names from parent modules"##,
}, },
Lint { Lint {
label: "pub-use-of-private-extern-crate", label: "pub_use_of_private_extern_crate",
description: r##"detect public re-exports of private extern crates"##, description: r##"detect public re-exports of private extern crates"##,
}, },
Lint { Lint {
label: "redundant-semicolons", label: "redundant_semicolons",
description: r##"detects unnecessary trailing semicolons"##, description: r##"detects unnecessary trailing semicolons"##,
}, },
Lint { Lint {
label: "renamed-and-removed-lints", label: "renamed_and_removed_lints",
description: r##"lints that have been renamed or removed"##, description: r##"lints that have been renamed or removed"##,
}, },
Lint { Lint {
label: "rust-2018-compatibility", label: "rust_2018_compatibility",
description: r##"lint group for: keyword-idents, anonymous-parameters, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate"##, description: r##"lint group for: keyword-idents, anonymous-parameters, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate"##,
}, },
Lint { Lint {
label: "rust-2018-idioms", label: "rust_2018_idioms",
description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##, description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##,
}, },
Lint { Lint {
label: "rust-2021-compatibility", label: "rust_2021_compatibility",
description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##, description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##,
}, },
Lint { Lint {
label: "semicolon-in-expressions-from-macros", label: "semicolon_in_expressions_from_macros",
description: r##"trailing semicolon in macro body used as expression"##, description: r##"trailing semicolon in macro body used as expression"##,
}, },
Lint { Lint {
label: "single-use-lifetimes", label: "single_use_lifetimes",
description: r##"detects lifetime parameters that are only used once"##, description: r##"detects lifetime parameters that are only used once"##,
}, },
Lint { Lint {
label: "soft-unstable", label: "soft_unstable",
description: r##"a feature gate that doesn't break dependent crates"##, description: r##"a feature gate that doesn't break dependent crates"##,
}, },
Lint { Lint {
label: "stable-features", label: "stable_features",
description: r##"stable features found in `#[feature]` directive"##, description: r##"stable features found in `#[feature]` directive"##,
}, },
Lint { Lint {
label: "temporary-cstring-as-ptr", label: "temporary_cstring_as_ptr",
description: r##"detects getting the inner pointer of a temporary `CString`"##, description: r##"detects getting the inner pointer of a temporary `CString`"##,
}, },
Lint { Lint {
label: "trivial-bounds", label: "trivial_bounds",
description: r##"these bounds don't depend on an type parameters"##, description: r##"these bounds don't depend on an type parameters"##,
}, },
Lint { Lint {
label: "trivial-casts", label: "trivial_casts",
description: r##"detects trivial casts which could be removed"##, description: r##"detects trivial casts which could be removed"##,
}, },
Lint { Lint {
label: "trivial-numeric-casts", label: "trivial_numeric_casts",
description: r##"detects trivial casts of numeric types which could be removed"##, description: r##"detects trivial casts of numeric types which could be removed"##,
}, },
Lint { Lint {
label: "type-alias-bounds", label: "type_alias_bounds",
description: r##"bounds in type aliases are not enforced"##, description: r##"bounds in type aliases are not enforced"##,
}, },
Lint { Lint {
label: "tyvar-behind-raw-pointer", label: "tyvar_behind_raw_pointer",
description: r##"raw pointer to an inference variable"##, description: r##"raw pointer to an inference variable"##,
}, },
Lint { Lint {
label: "unaligned-references", label: "unaligned_references",
description: r##"detects unaligned references to fields of packed structs"##, description: r##"detects unaligned references to fields of packed structs"##,
}, },
Lint { Lint {
label: "uncommon-codepoints", label: "uncommon_codepoints",
description: r##"detects uncommon Unicode codepoints in identifiers"##, description: r##"detects uncommon Unicode codepoints in identifiers"##,
}, },
Lint { Lint {
label: "unconditional-panic", label: "unconditional_panic",
description: r##"operation will cause a panic at runtime"##, description: r##"operation will cause a panic at runtime"##,
}, },
Lint { Lint {
label: "unconditional-recursion", label: "unconditional_recursion",
description: r##"functions that cannot return without calling themselves"##, description: r##"functions that cannot return without calling themselves"##,
}, },
Lint { label: "uninhabited-static", description: r##"uninhabited static"## }, Lint { label: "uninhabited_static", description: r##"uninhabited static"## },
Lint { Lint {
label: "unknown-crate-types", label: "unknown_crate_types",
description: r##"unknown crate type found in `#[crate_type]` directive"##, description: r##"unknown crate type found in `#[crate_type]` directive"##,
}, },
Lint { label: "unknown-lints", description: r##"unrecognized lint attribute"## }, Lint { label: "unknown_lints", description: r##"unrecognized lint attribute"## },
Lint { Lint {
label: "unnameable-test-items", label: "unnameable_test_items",
description: r##"detects an item that cannot be named being marked as `#[test_case]`"##, description: r##"detects an item that cannot be named being marked as `#[test_case]`"##,
}, },
Lint { label: "unreachable-code", description: r##"detects unreachable code paths"## }, Lint { label: "unreachable_code", description: r##"detects unreachable code paths"## },
Lint { label: "unreachable-patterns", description: r##"detects unreachable patterns"## }, Lint { label: "unreachable_patterns", description: r##"detects unreachable patterns"## },
Lint { Lint {
label: "unreachable-pub", label: "unreachable_pub",
description: r##"`pub` items not reachable from crate root"##, description: r##"`pub` items not reachable from crate root"##,
}, },
Lint { label: "unsafe-code", description: r##"usage of `unsafe` code"## }, Lint { label: "unsafe_code", description: r##"usage of `unsafe` code"## },
Lint { Lint {
label: "unsafe-op-in-unsafe-fn", label: "unsafe_op_in_unsafe_fn",
description: r##"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"##, description: r##"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"##,
}, },
Lint { Lint {
label: "unstable-features", label: "unstable_features",
description: r##"enabling unstable features (deprecated. do not use)"##, description: r##"enabling unstable features (deprecated. do not use)"##,
}, },
Lint { Lint {
label: "unstable-name-collisions", label: "unstable_name_collisions",
description: r##"detects name collision with an existing but unstable method"##, description: r##"detects name collision with an existing but unstable method"##,
}, },
Lint { Lint {
label: "unsupported-naked-functions", label: "unsupported_naked_functions",
description: r##"unsupported naked function definitions"##, description: r##"unsupported naked function definitions"##,
}, },
Lint { Lint {
@ -391,77 +389,77 @@ pub const DEFAULT_LINTS: &[Lint] = &[
description: r##"lint group for: unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unreachable-patterns, unused-must-use, unused-unsafe, path-statements, unused-attributes, unused-macros, unused-allocation, unused-doc-comments, unused-extern-crates, unused-features, unused-labels, unused-parens, unused-braces, redundant-semicolons"##, description: r##"lint group for: unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unreachable-patterns, unused-must-use, unused-unsafe, path-statements, unused-attributes, unused-macros, unused-allocation, unused-doc-comments, unused-extern-crates, unused-features, unused-labels, unused-parens, unused-braces, redundant-semicolons"##,
}, },
Lint { Lint {
label: "unused-allocation", label: "unused_allocation",
description: r##"detects unnecessary allocations that can be eliminated"##, description: r##"detects unnecessary allocations that can be eliminated"##,
}, },
Lint { Lint {
label: "unused-assignments", label: "unused_assignments",
description: r##"detect assignments that will never be read"##, description: r##"detect assignments that will never be read"##,
}, },
Lint { Lint {
label: "unused-attributes", label: "unused_attributes",
description: r##"detects attributes that were not used by the compiler"##, description: r##"detects attributes that were not used by the compiler"##,
}, },
Lint { label: "unused-braces", description: r##"unnecessary braces around an expression"## }, Lint { label: "unused_braces", description: r##"unnecessary braces around an expression"## },
Lint { Lint {
label: "unused-comparisons", label: "unused_comparisons",
description: r##"comparisons made useless by limits of the types involved"##, description: r##"comparisons made useless by limits of the types involved"##,
}, },
Lint { Lint {
label: "unused-crate-dependencies", label: "unused_crate_dependencies",
description: r##"crate dependencies that are never used"##, description: r##"crate dependencies that are never used"##,
}, },
Lint { Lint {
label: "unused-doc-comments", label: "unused_doc_comments",
description: r##"detects doc comments that aren't used by rustdoc"##, description: r##"detects doc comments that aren't used by rustdoc"##,
}, },
Lint { label: "unused-extern-crates", description: r##"extern crates that are never used"## }, Lint { label: "unused_extern_crates", description: r##"extern crates that are never used"## },
Lint { Lint {
label: "unused-features", label: "unused_features",
description: r##"unused features found in crate-level `#[feature]` directives"##, description: r##"unused features found in crate-level `#[feature]` directives"##,
}, },
Lint { Lint {
label: "unused-import-braces", label: "unused_import_braces",
description: r##"unnecessary braces around an imported item"##, description: r##"unnecessary braces around an imported item"##,
}, },
Lint { label: "unused-imports", description: r##"imports that are never used"## }, Lint { label: "unused_imports", description: r##"imports that are never used"## },
Lint { label: "unused-labels", description: r##"detects labels that are never used"## }, Lint { label: "unused_labels", description: r##"detects labels that are never used"## },
Lint { Lint {
label: "unused-lifetimes", label: "unused_lifetimes",
description: r##"detects lifetime parameters that are never used"##, description: r##"detects lifetime parameters that are never used"##,
}, },
Lint { label: "unused-macros", description: r##"detects macros that were not used"## }, Lint { label: "unused_macros", description: r##"detects macros that were not used"## },
Lint { Lint {
label: "unused-must-use", label: "unused_must_use",
description: r##"unused result of a type flagged as `#[must_use]`"##, description: r##"unused result of a type flagged as `#[must_use]`"##,
}, },
Lint { Lint {
label: "unused-mut", label: "unused_mut",
description: r##"detect mut variables which don't need to be mutable"##, description: r##"detect mut variables which don't need to be mutable"##,
}, },
Lint { Lint {
label: "unused-parens", label: "unused_parens",
description: r##"`if`, `match`, `while` and `return` do not need parentheses"##, description: r##"`if`, `match`, `while` and `return` do not need parentheses"##,
}, },
Lint { Lint {
label: "unused-qualifications", label: "unused_qualifications",
description: r##"detects unnecessarily qualified names"##, description: r##"detects unnecessarily qualified names"##,
}, },
Lint { Lint {
label: "unused-results", label: "unused_results",
description: r##"unused result of an expression in a statement"##, description: r##"unused result of an expression in a statement"##,
}, },
Lint { label: "unused-unsafe", description: r##"unnecessary use of an `unsafe` block"## }, Lint { label: "unused_unsafe", description: r##"unnecessary use of an `unsafe` block"## },
Lint { Lint {
label: "unused-variables", label: "unused_variables",
description: r##"detect variables which are not used in any way"##, description: r##"detect variables which are not used in any way"##,
}, },
Lint { Lint {
label: "useless-deprecated", label: "useless_deprecated",
description: r##"detects deprecation attributes with no effect"##, description: r##"detects deprecation attributes with no effect"##,
}, },
Lint { Lint {
label: "variant-size-differences", label: "variant_size_differences",
description: r##"detects enums with widely varying variant sizes"##, description: r##"detects enums with widely varying variant sizes"##,
}, },
Lint { Lint {
@ -473,11 +471,11 @@ pub const DEFAULT_LINTS: &[Lint] = &[
description: r##"lint group for: all lints that are set to issue warnings"##, description: r##"lint group for: all lints that are set to issue warnings"##,
}, },
Lint { Lint {
label: "where-clauses-object-safety", label: "where_clauses_object_safety",
description: r##"checks the object safety of where clauses"##, description: r##"checks the object safety of where clauses"##,
}, },
Lint { Lint {
label: "while-true", label: "while_true",
description: r##"suggest using `loop { }` instead of `while true { }`"##, description: r##"suggest using `loop { }` instead of `while true { }`"##,
}, },
]; ];

View file

@ -52,6 +52,7 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> {
buf.push('\n'); buf.push('\n');
let mut lints = stdout[start_lints..end_lints] let mut lints = stdout[start_lints..end_lints]
.lines() .lines()
.skip(1)
.filter(|l| !l.is_empty()) .filter(|l| !l.is_empty())
.map(|line| { .map(|line| {
let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap(); let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap();
@ -60,15 +61,19 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> {
(name.trim(), Cow::Borrowed(description.trim())) (name.trim(), Cow::Borrowed(description.trim()))
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
lints.extend(stdout[start_lint_groups..end_lint_groups].lines().filter(|l| !l.is_empty()).map( lints.extend(
|line| { stdout[start_lint_groups..end_lint_groups].lines().skip(1).filter(|l| !l.is_empty()).map(
let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap(); |line| {
(name.trim(), format!("lint group for: {}", lints.trim()).into()) let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap();
}, (name.trim(), format!("lint group for: {}", lints.trim()).into())
)); },
),
);
lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2)); lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2));
lints.into_iter().for_each(|(name, description)| push_lint_completion(buf, name, &description)); lints.into_iter().for_each(|(name, description)| {
push_lint_completion(buf, &name.replace("-", "_"), &description)
});
buf.push_str("];\n"); buf.push_str("];\n");
Ok(()) Ok(())
} }