mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Replace -
with _
in generated lint names
This commit is contained in:
parent
0b9ba4977e
commit
0c89f38378
3 changed files with 151 additions and 150 deletions
|
@ -123,6 +123,7 @@ pub(crate) fn hover(
|
|||
|
||||
_ => {
|
||||
if ast::Comment::cast(token.clone()).is_some() {
|
||||
cov_mark::hit!(no_highlight_on_comment_hover);
|
||||
let (attributes, def) = doc_attributes(&sema, &node)?;
|
||||
let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?;
|
||||
let (idl_range, link, ns) =
|
||||
|
@ -136,8 +137,10 @@ pub(crate) fn hover(
|
|||
})?;
|
||||
range = Some(idl_range);
|
||||
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 {
|
||||
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) {
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -6,384 +6,382 @@ pub struct Lint {
|
|||
}
|
||||
|
||||
pub const DEFAULT_LINTS: &[Lint] = &[
|
||||
Lint { label: "----", description: r##"-------"## },
|
||||
Lint { label: "----", description: r##"lint group for: ---------"## },
|
||||
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"##,
|
||||
},
|
||||
Lint { label: "ambiguous-associated-items", description: r##"ambiguous associated items"## },
|
||||
Lint { label: "anonymous-parameters", description: r##"detects anonymous parameters"## },
|
||||
Lint { label: "arithmetic-overflow", description: r##"arithmetic operation overflows"## },
|
||||
Lint { label: "array-into-iter", description: r##"detects calling `into_iter` on arrays"## },
|
||||
Lint { label: "ambiguous_associated_items", description: r##"ambiguous associated items"## },
|
||||
Lint { label: "anonymous_parameters", description: r##"detects anonymous parameters"## },
|
||||
Lint { label: "arithmetic_overflow", description: r##"arithmetic operation overflows"## },
|
||||
Lint { label: "array_into_iter", description: r##"detects calling `into_iter` on arrays"## },
|
||||
Lint {
|
||||
label: "asm-sub-register",
|
||||
label: "asm_sub_register",
|
||||
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 {
|
||||
label: "bare-trait-objects",
|
||||
label: "bare_trait_objects",
|
||||
description: r##"suggest using `dyn Trait` for trait objects"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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 {
|
||||
label: "cenum-impl-drop-cast",
|
||||
label: "cenum_impl_drop_cast",
|
||||
description: r##"a C-like enum implementing Drop is cast"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "coherence-leak-check",
|
||||
label: "coherence_leak_check",
|
||||
description: r##"distinct impls distinguished only by the leak-check code"##,
|
||||
},
|
||||
Lint {
|
||||
label: "conflicting-repr-hints",
|
||||
label: "conflicting_repr_hints",
|
||||
description: r##"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"##,
|
||||
},
|
||||
Lint {
|
||||
label: "confusable-idents",
|
||||
label: "confusable_idents",
|
||||
description: r##"detects visually confusable pairs between identifiers"##,
|
||||
},
|
||||
Lint {
|
||||
label: "const-err",
|
||||
label: "const_err",
|
||||
description: r##"constant evaluation encountered erroneous expression"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "const-item-mutation",
|
||||
label: "const_item_mutation",
|
||||
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-in-future",
|
||||
label: "deprecated_in_future",
|
||||
description: r##"detects use of items that will be deprecated in a future version"##,
|
||||
},
|
||||
Lint {
|
||||
label: "deref-nullptr",
|
||||
label: "deref_nullptr",
|
||||
description: r##"detects when an null pointer is dereferenced"##,
|
||||
},
|
||||
Lint {
|
||||
label: "disjoint-capture-migration",
|
||||
label: "disjoint_capture_migration",
|
||||
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 {
|
||||
label: "elided-lifetimes-in-paths",
|
||||
label: "elided_lifetimes_in_paths",
|
||||
description: r##"hidden lifetime parameters in types are deprecated"##,
|
||||
},
|
||||
Lint {
|
||||
label: "ellipsis-inclusive-range-patterns",
|
||||
label: "ellipsis_inclusive_range_patterns",
|
||||
description: r##"`...` range patterns are deprecated"##,
|
||||
},
|
||||
Lint {
|
||||
label: "explicit-outlives-requirements",
|
||||
label: "explicit_outlives_requirements",
|
||||
description: r##"outlives requirements can be inferred"##,
|
||||
},
|
||||
Lint {
|
||||
label: "exported-private-dependencies",
|
||||
label: "exported_private_dependencies",
|
||||
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 {
|
||||
label: "function-item-references",
|
||||
label: "function_item_references",
|
||||
description: r##"suggest casting to a function pointer when attempting to take references to function items"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "illegal-floating-point-literal-pattern",
|
||||
label: "illegal_floating_point_literal_pattern",
|
||||
description: r##"floating-point literals cannot be used in patterns"##,
|
||||
},
|
||||
Lint {
|
||||
label: "improper-ctypes",
|
||||
label: "improper_ctypes",
|
||||
description: r##"proper use of libc types in foreign modules"##,
|
||||
},
|
||||
Lint {
|
||||
label: "improper-ctypes-definitions",
|
||||
label: "improper_ctypes_definitions",
|
||||
description: r##"proper use of libc types in foreign item definitions"##,
|
||||
},
|
||||
Lint {
|
||||
label: "incomplete-features",
|
||||
label: "incomplete_features",
|
||||
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 {
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "ineffective-unstable-trait-impl",
|
||||
label: "ineffective_unstable_trait_impl",
|
||||
description: r##"detects `#[unstable]` on stable trait implementations for stable types"##,
|
||||
},
|
||||
Lint {
|
||||
label: "inline-no-sanitize",
|
||||
label: "inline_no_sanitize",
|
||||
description: r##"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"##,
|
||||
},
|
||||
Lint {
|
||||
label: "invalid-type-param-default",
|
||||
label: "invalid_type_param_default",
|
||||
description: r##"type parameter default erroneously allowed in invalid location"##,
|
||||
},
|
||||
Lint {
|
||||
label: "invalid-value",
|
||||
label: "invalid_value",
|
||||
description: r##"an invalid value is being created (such as a null reference)"##,
|
||||
},
|
||||
Lint {
|
||||
label: "irrefutable-let-patterns",
|
||||
label: "irrefutable_let_patterns",
|
||||
description: r##"detects irrefutable patterns in `if let` and `while let` statements"##,
|
||||
},
|
||||
Lint {
|
||||
label: "keyword-idents",
|
||||
label: "keyword_idents",
|
||||
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 {
|
||||
label: "late-bound-lifetime-arguments",
|
||||
label: "late_bound_lifetime_arguments",
|
||||
description: r##"detects generic lifetime arguments in path segments with late bound lifetime parameters"##,
|
||||
},
|
||||
Lint {
|
||||
label: "legacy-derive-helpers",
|
||||
label: "legacy_derive_helpers",
|
||||
description: r##"detects derive helper attributes that are used before they are introduced"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "meta-variable-misuse",
|
||||
label: "meta_variable_misuse",
|
||||
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 {
|
||||
label: "missing-copy-implementations",
|
||||
label: "missing_copy_implementations",
|
||||
description: r##"detects potentially-forgotten implementations of `Copy`"##,
|
||||
},
|
||||
Lint {
|
||||
label: "missing-debug-implementations",
|
||||
label: "missing_debug_implementations",
|
||||
description: r##"detects missing implementations of Debug"##,
|
||||
},
|
||||
Lint {
|
||||
label: "missing-docs",
|
||||
label: "missing_docs",
|
||||
description: r##"detects missing documentation for public members"##,
|
||||
},
|
||||
Lint {
|
||||
label: "missing-fragment-specifier",
|
||||
label: "missing_fragment_specifier",
|
||||
description: r##"detects missing fragment specifiers in unused `macro_rules!` patterns"##,
|
||||
},
|
||||
Lint {
|
||||
label: "mixed-script-confusables",
|
||||
label: "mixed_script_confusables",
|
||||
description: r##"detects Unicode scripts whose mixed script confusables codepoints are solely used"##,
|
||||
},
|
||||
Lint {
|
||||
label: "mutable-borrow-reservation-conflict",
|
||||
label: "mutable_borrow_reservation_conflict",
|
||||
description: r##"reservation of a two-phased borrow conflicts with other shared borrows"##,
|
||||
},
|
||||
Lint {
|
||||
label: "mutable-transmutes",
|
||||
label: "mutable_transmutes",
|
||||
description: r##"mutating transmuted &mut T from &T may cause undefined behavior"##,
|
||||
},
|
||||
Lint {
|
||||
label: "no-mangle-const-items",
|
||||
label: "no_mangle_const_items",
|
||||
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: "non-ascii-idents", description: r##"detects non-ASCII identifiers"## },
|
||||
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-camel-case-types",
|
||||
label: "non_camel_case_types",
|
||||
description: r##"types, variants, traits and type parameters should have camel case names"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "non-shorthand-field-patterns",
|
||||
label: "non_shorthand_field_patterns",
|
||||
description: r##"using `Struct { x: x }` instead of `Struct { x }` in a pattern"##,
|
||||
},
|
||||
Lint {
|
||||
label: "non-snake-case",
|
||||
label: "non_snake_case",
|
||||
description: r##"variables, methods, functions, lifetime parameters and modules should have snake case names"##,
|
||||
},
|
||||
Lint {
|
||||
label: "non-upper-case-globals",
|
||||
label: "non_upper_case_globals",
|
||||
description: r##"static constants should have uppercase identifiers"##,
|
||||
},
|
||||
Lint {
|
||||
label: "nonstandard-style",
|
||||
label: "nonstandard_style",
|
||||
description: r##"lint group for: non-camel-case-types, non-snake-case, non-upper-case-globals"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "noop-method-call",
|
||||
label: "noop_method_call",
|
||||
description: r##"detects the use of well-known noop methods"##,
|
||||
},
|
||||
Lint {
|
||||
label: "or-patterns-back-compat",
|
||||
label: "or_patterns_back_compat",
|
||||
description: r##"detects usage of old versions of or-patterns"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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 {
|
||||
label: "overlapping-range-endpoints",
|
||||
label: "overlapping_range_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 {
|
||||
label: "patterns-in-fns-without-body",
|
||||
label: "patterns_in_fns_without_body",
|
||||
description: r##"patterns in functions without body were erroneously allowed"##,
|
||||
},
|
||||
Lint {
|
||||
label: "pointer-structural-match",
|
||||
label: "pointer_structural_match",
|
||||
description: r##"pointers are not structural-match"##,
|
||||
},
|
||||
Lint {
|
||||
label: "private-in-public",
|
||||
label: "private_in_public",
|
||||
description: r##"detect private items in public interfaces not caught by the old implementation"##,
|
||||
},
|
||||
Lint {
|
||||
label: "proc-macro-back-compat",
|
||||
label: "proc_macro_back_compat",
|
||||
description: r##"detects usage of old versions of certain proc-macro crates"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "redundant-semicolons",
|
||||
label: "redundant_semicolons",
|
||||
description: r##"detects unnecessary trailing semicolons"##,
|
||||
},
|
||||
Lint {
|
||||
label: "renamed-and-removed-lints",
|
||||
label: "renamed_and_removed_lints",
|
||||
description: r##"lints that have been renamed or removed"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "rust-2021-compatibility",
|
||||
label: "rust_2021_compatibility",
|
||||
description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##,
|
||||
},
|
||||
Lint {
|
||||
label: "semicolon-in-expressions-from-macros",
|
||||
label: "semicolon_in_expressions_from_macros",
|
||||
description: r##"trailing semicolon in macro body used as expression"##,
|
||||
},
|
||||
Lint {
|
||||
label: "single-use-lifetimes",
|
||||
label: "single_use_lifetimes",
|
||||
description: r##"detects lifetime parameters that are only used once"##,
|
||||
},
|
||||
Lint {
|
||||
label: "soft-unstable",
|
||||
label: "soft_unstable",
|
||||
description: r##"a feature gate that doesn't break dependent crates"##,
|
||||
},
|
||||
Lint {
|
||||
label: "stable-features",
|
||||
label: "stable_features",
|
||||
description: r##"stable features found in `#[feature]` directive"##,
|
||||
},
|
||||
Lint {
|
||||
label: "temporary-cstring-as-ptr",
|
||||
label: "temporary_cstring_as_ptr",
|
||||
description: r##"detects getting the inner pointer of a temporary `CString`"##,
|
||||
},
|
||||
Lint {
|
||||
label: "trivial-bounds",
|
||||
label: "trivial_bounds",
|
||||
description: r##"these bounds don't depend on an type parameters"##,
|
||||
},
|
||||
Lint {
|
||||
label: "trivial-casts",
|
||||
label: "trivial_casts",
|
||||
description: r##"detects trivial casts which could be removed"##,
|
||||
},
|
||||
Lint {
|
||||
label: "trivial-numeric-casts",
|
||||
label: "trivial_numeric_casts",
|
||||
description: r##"detects trivial casts of numeric types which could be removed"##,
|
||||
},
|
||||
Lint {
|
||||
label: "type-alias-bounds",
|
||||
label: "type_alias_bounds",
|
||||
description: r##"bounds in type aliases are not enforced"##,
|
||||
},
|
||||
Lint {
|
||||
label: "tyvar-behind-raw-pointer",
|
||||
label: "tyvar_behind_raw_pointer",
|
||||
description: r##"raw pointer to an inference variable"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unaligned-references",
|
||||
label: "unaligned_references",
|
||||
description: r##"detects unaligned references to fields of packed structs"##,
|
||||
},
|
||||
Lint {
|
||||
label: "uncommon-codepoints",
|
||||
label: "uncommon_codepoints",
|
||||
description: r##"detects uncommon Unicode codepoints in identifiers"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unconditional-panic",
|
||||
label: "unconditional_panic",
|
||||
description: r##"operation will cause a panic at runtime"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unconditional-recursion",
|
||||
label: "unconditional_recursion",
|
||||
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 {
|
||||
label: "unknown-crate-types",
|
||||
label: "unknown_crate_types",
|
||||
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 {
|
||||
label: "unnameable-test-items",
|
||||
label: "unnameable_test_items",
|
||||
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-patterns", description: r##"detects unreachable patterns"## },
|
||||
Lint { label: "unreachable_code", description: r##"detects unreachable code paths"## },
|
||||
Lint { label: "unreachable_patterns", description: r##"detects unreachable patterns"## },
|
||||
Lint {
|
||||
label: "unreachable-pub",
|
||||
label: "unreachable_pub",
|
||||
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 {
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unstable-features",
|
||||
label: "unstable_features",
|
||||
description: r##"enabling unstable features (deprecated. do not use)"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unstable-name-collisions",
|
||||
label: "unstable_name_collisions",
|
||||
description: r##"detects name collision with an existing but unstable method"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unsupported-naked-functions",
|
||||
label: "unsupported_naked_functions",
|
||||
description: r##"unsupported naked function definitions"##,
|
||||
},
|
||||
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"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-allocation",
|
||||
label: "unused_allocation",
|
||||
description: r##"detects unnecessary allocations that can be eliminated"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-assignments",
|
||||
label: "unused_assignments",
|
||||
description: r##"detect assignments that will never be read"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-attributes",
|
||||
label: "unused_attributes",
|
||||
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 {
|
||||
label: "unused-comparisons",
|
||||
label: "unused_comparisons",
|
||||
description: r##"comparisons made useless by limits of the types involved"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-crate-dependencies",
|
||||
label: "unused_crate_dependencies",
|
||||
description: r##"crate dependencies that are never used"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-doc-comments",
|
||||
label: "unused_doc_comments",
|
||||
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 {
|
||||
label: "unused-features",
|
||||
label: "unused_features",
|
||||
description: r##"unused features found in crate-level `#[feature]` directives"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-import-braces",
|
||||
label: "unused_import_braces",
|
||||
description: r##"unnecessary braces around an imported item"##,
|
||||
},
|
||||
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_imports", description: r##"imports that are never used"## },
|
||||
Lint { label: "unused_labels", description: r##"detects labels that are never used"## },
|
||||
Lint {
|
||||
label: "unused-lifetimes",
|
||||
label: "unused_lifetimes",
|
||||
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 {
|
||||
label: "unused-must-use",
|
||||
label: "unused_must_use",
|
||||
description: r##"unused result of a type flagged as `#[must_use]`"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-mut",
|
||||
label: "unused_mut",
|
||||
description: r##"detect mut variables which don't need to be mutable"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-parens",
|
||||
label: "unused_parens",
|
||||
description: r##"`if`, `match`, `while` and `return` do not need parentheses"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-qualifications",
|
||||
label: "unused_qualifications",
|
||||
description: r##"detects unnecessarily qualified names"##,
|
||||
},
|
||||
Lint {
|
||||
label: "unused-results",
|
||||
label: "unused_results",
|
||||
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 {
|
||||
label: "unused-variables",
|
||||
label: "unused_variables",
|
||||
description: r##"detect variables which are not used in any way"##,
|
||||
},
|
||||
Lint {
|
||||
label: "useless-deprecated",
|
||||
label: "useless_deprecated",
|
||||
description: r##"detects deprecation attributes with no effect"##,
|
||||
},
|
||||
Lint {
|
||||
label: "variant-size-differences",
|
||||
label: "variant_size_differences",
|
||||
description: r##"detects enums with widely varying variant sizes"##,
|
||||
},
|
||||
Lint {
|
||||
|
@ -473,11 +471,11 @@ pub const DEFAULT_LINTS: &[Lint] = &[
|
|||
description: r##"lint group for: all lints that are set to issue warnings"##,
|
||||
},
|
||||
Lint {
|
||||
label: "where-clauses-object-safety",
|
||||
label: "where_clauses_object_safety",
|
||||
description: r##"checks the object safety of where clauses"##,
|
||||
},
|
||||
Lint {
|
||||
label: "while-true",
|
||||
label: "while_true",
|
||||
description: r##"suggest using `loop { }` instead of `while true { }`"##,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -52,6 +52,7 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> {
|
|||
buf.push('\n');
|
||||
let mut lints = stdout[start_lints..end_lints]
|
||||
.lines()
|
||||
.skip(1)
|
||||
.filter(|l| !l.is_empty())
|
||||
.map(|line| {
|
||||
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()))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
lints.extend(stdout[start_lint_groups..end_lint_groups].lines().filter(|l| !l.is_empty()).map(
|
||||
lints.extend(
|
||||
stdout[start_lint_groups..end_lint_groups].lines().skip(1).filter(|l| !l.is_empty()).map(
|
||||
|line| {
|
||||
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.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");
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue