diff options
-rw-r--r-- | crates/ide/src/hover.rs | 10 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/generated_lints.rs | 272 | ||||
-rw-r--r-- | xtask/src/codegen/gen_lint_completions.rs | 19 |
3 files changed, 151 insertions, 150 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index f3f6f749c..573ffd10d 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -123,6 +123,7 @@ pub(crate) fn hover( | |||
123 | 123 | ||
124 | _ => { | 124 | _ => { |
125 | if ast::Comment::cast(token.clone()).is_some() { | 125 | if ast::Comment::cast(token.clone()).is_some() { |
126 | cov_mark::hit!(no_highlight_on_comment_hover); | ||
126 | let (attributes, def) = doc_attributes(&sema, &node)?; | 127 | let (attributes, def) = doc_attributes(&sema, &node)?; |
127 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; | 128 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; |
128 | let (idl_range, link, ns) = | 129 | let (idl_range, link, ns) = |
@@ -136,8 +137,10 @@ pub(crate) fn hover( | |||
136 | })?; | 137 | })?; |
137 | range = Some(idl_range); | 138 | range = Some(idl_range); |
138 | resolve_doc_path_for_def(db, def, &link, ns).map(Definition::ModuleDef) | 139 | resolve_doc_path_for_def(db, def, &link, ns).map(Definition::ModuleDef) |
140 | } else if let res@Some(_) = try_hover_for_attribute(&token) { | ||
141 | return res; | ||
139 | } else { | 142 | } else { |
140 | return try_hover_for_attribute(&token); | 143 | None |
141 | } | 144 | } |
142 | }, | 145 | }, |
143 | } | 146 | } |
@@ -169,11 +172,6 @@ pub(crate) fn hover( | |||
169 | } | 172 | } |
170 | } | 173 | } |
171 | 174 | ||
172 | if token.kind() == syntax::SyntaxKind::COMMENT { | ||
173 | cov_mark::hit!(no_highlight_on_comment_hover); | ||
174 | return None; | ||
175 | } | ||
176 | |||
177 | if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, &token) { | 175 | if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, &token) { |
178 | return res; | 176 | return res; |
179 | } | 177 | } |
diff --git a/crates/ide_db/src/helpers/generated_lints.rs b/crates/ide_db/src/helpers/generated_lints.rs index c16436284..6ccb0478e 100644 --- a/crates/ide_db/src/helpers/generated_lints.rs +++ b/crates/ide_db/src/helpers/generated_lints.rs | |||
@@ -6,384 +6,382 @@ pub struct Lint { | |||
6 | } | 6 | } |
7 | 7 | ||
8 | pub const DEFAULT_LINTS: &[Lint] = &[ | 8 | pub const DEFAULT_LINTS: &[Lint] = &[ |
9 | Lint { label: "----", description: r##"-------"## }, | ||
10 | Lint { label: "----", description: r##"lint group for: ---------"## }, | ||
11 | Lint { | 9 | Lint { |
12 | label: "absolute-paths-not-starting-with-crate", | 10 | label: "absolute_paths_not_starting_with_crate", |
13 | description: r##"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"##, | 11 | description: r##"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"##, |
14 | }, | 12 | }, |
15 | Lint { label: "ambiguous-associated-items", description: r##"ambiguous associated items"## }, | 13 | Lint { label: "ambiguous_associated_items", description: r##"ambiguous associated items"## }, |
16 | Lint { label: "anonymous-parameters", description: r##"detects anonymous parameters"## }, | 14 | Lint { label: "anonymous_parameters", description: r##"detects anonymous parameters"## }, |
17 | Lint { label: "arithmetic-overflow", description: r##"arithmetic operation overflows"## }, | 15 | Lint { label: "arithmetic_overflow", description: r##"arithmetic operation overflows"## }, |
18 | Lint { label: "array-into-iter", description: r##"detects calling `into_iter` on arrays"## }, | 16 | Lint { label: "array_into_iter", description: r##"detects calling `into_iter` on arrays"## }, |
19 | Lint { | 17 | Lint { |
20 | label: "asm-sub-register", | 18 | label: "asm_sub_register", |
21 | description: r##"using only a subset of a register for inline asm inputs"##, | 19 | description: r##"using only a subset of a register for inline asm inputs"##, |
22 | }, | 20 | }, |
23 | Lint { label: "bad-asm-style", description: r##"incorrect use of inline assembly"## }, | 21 | Lint { label: "bad_asm_style", description: r##"incorrect use of inline assembly"## }, |
24 | Lint { | 22 | Lint { |
25 | label: "bare-trait-objects", | 23 | label: "bare_trait_objects", |
26 | description: r##"suggest using `dyn Trait` for trait objects"##, | 24 | description: r##"suggest using `dyn Trait` for trait objects"##, |
27 | }, | 25 | }, |
28 | Lint { | 26 | Lint { |
29 | label: "bindings-with-variant-name", | 27 | label: "bindings_with_variant_name", |
30 | description: r##"detects pattern bindings with the same name as one of the matched variants"##, | 28 | description: r##"detects pattern bindings with the same name as one of the matched variants"##, |
31 | }, | 29 | }, |
32 | Lint { label: "box-pointers", description: r##"use of owned (Box type) heap memory"## }, | 30 | Lint { label: "box_pointers", description: r##"use of owned (Box type) heap memory"## }, |
33 | Lint { | 31 | Lint { |
34 | label: "cenum-impl-drop-cast", | 32 | label: "cenum_impl_drop_cast", |
35 | description: r##"a C-like enum implementing Drop is cast"##, | 33 | description: r##"a C-like enum implementing Drop is cast"##, |
36 | }, | 34 | }, |
37 | Lint { | 35 | Lint { |
38 | label: "clashing-extern-declarations", | 36 | label: "clashing_extern_declarations", |
39 | description: r##"detects when an extern fn has been declared with the same name but different types"##, | 37 | description: r##"detects when an extern fn has been declared with the same name but different types"##, |
40 | }, | 38 | }, |
41 | Lint { | 39 | Lint { |
42 | label: "coherence-leak-check", | 40 | label: "coherence_leak_check", |
43 | description: r##"distinct impls distinguished only by the leak-check code"##, | 41 | description: r##"distinct impls distinguished only by the leak-check code"##, |
44 | }, | 42 | }, |
45 | Lint { | 43 | Lint { |
46 | label: "conflicting-repr-hints", | 44 | label: "conflicting_repr_hints", |
47 | description: r##"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"##, | 45 | description: r##"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"##, |
48 | }, | 46 | }, |
49 | Lint { | 47 | Lint { |
50 | label: "confusable-idents", | 48 | label: "confusable_idents", |
51 | description: r##"detects visually confusable pairs between identifiers"##, | 49 | description: r##"detects visually confusable pairs between identifiers"##, |
52 | }, | 50 | }, |
53 | Lint { | 51 | Lint { |
54 | label: "const-err", | 52 | label: "const_err", |
55 | description: r##"constant evaluation encountered erroneous expression"##, | 53 | description: r##"constant evaluation encountered erroneous expression"##, |
56 | }, | 54 | }, |
57 | Lint { | 55 | Lint { |
58 | label: "const-evaluatable-unchecked", | 56 | label: "const_evaluatable_unchecked", |
59 | description: r##"detects a generic constant is used in a type without a emitting a warning"##, | 57 | description: r##"detects a generic constant is used in a type without a emitting a warning"##, |
60 | }, | 58 | }, |
61 | Lint { | 59 | Lint { |
62 | label: "const-item-mutation", | 60 | label: "const_item_mutation", |
63 | description: r##"detects attempts to mutate a `const` item"##, | 61 | description: r##"detects attempts to mutate a `const` item"##, |
64 | }, | 62 | }, |
65 | Lint { label: "dead-code", description: r##"detect unused, unexported items"## }, | 63 | Lint { label: "dead_code", description: r##"detect unused, unexported items"## }, |
66 | Lint { label: "deprecated", description: r##"detects use of deprecated items"## }, | 64 | Lint { label: "deprecated", description: r##"detects use of deprecated items"## }, |
67 | Lint { | 65 | Lint { |
68 | label: "deprecated-in-future", | 66 | label: "deprecated_in_future", |
69 | description: r##"detects use of items that will be deprecated in a future version"##, | 67 | description: r##"detects use of items that will be deprecated in a future version"##, |
70 | }, | 68 | }, |
71 | Lint { | 69 | Lint { |
72 | label: "deref-nullptr", | 70 | label: "deref_nullptr", |
73 | description: r##"detects when an null pointer is dereferenced"##, | 71 | description: r##"detects when an null pointer is dereferenced"##, |
74 | }, | 72 | }, |
75 | Lint { | 73 | Lint { |
76 | label: "disjoint-capture-migration", | 74 | label: "disjoint_capture_migration", |
77 | description: r##"Drop reorder and auto traits error because of `capture_disjoint_fields`"##, | 75 | description: r##"Drop reorder and auto traits error because of `capture_disjoint_fields`"##, |
78 | }, | 76 | }, |
79 | Lint { label: "drop-bounds", description: r##"bounds of the form `T: Drop` are useless"## }, | 77 | Lint { label: "drop_bounds", description: r##"bounds of the form `T: Drop` are useless"## }, |
80 | Lint { | 78 | Lint { |
81 | label: "elided-lifetimes-in-paths", | 79 | label: "elided_lifetimes_in_paths", |
82 | description: r##"hidden lifetime parameters in types are deprecated"##, | 80 | description: r##"hidden lifetime parameters in types are deprecated"##, |
83 | }, | 81 | }, |
84 | Lint { | 82 | Lint { |
85 | label: "ellipsis-inclusive-range-patterns", | 83 | label: "ellipsis_inclusive_range_patterns", |
86 | description: r##"`...` range patterns are deprecated"##, | 84 | description: r##"`...` range patterns are deprecated"##, |
87 | }, | 85 | }, |
88 | Lint { | 86 | Lint { |
89 | label: "explicit-outlives-requirements", | 87 | label: "explicit_outlives_requirements", |
90 | description: r##"outlives requirements can be inferred"##, | 88 | description: r##"outlives requirements can be inferred"##, |
91 | }, | 89 | }, |
92 | Lint { | 90 | Lint { |
93 | label: "exported-private-dependencies", | 91 | label: "exported_private_dependencies", |
94 | description: r##"public interface leaks type from a private dependency"##, | 92 | description: r##"public interface leaks type from a private dependency"##, |
95 | }, | 93 | }, |
96 | Lint { label: "forbidden-lint-groups", description: r##"applying forbid to lint-groups"## }, | 94 | Lint { label: "forbidden_lint_groups", description: r##"applying forbid to lint-groups"## }, |
97 | Lint { | 95 | Lint { |
98 | label: "function-item-references", | 96 | label: "function_item_references", |
99 | description: r##"suggest casting to a function pointer when attempting to take references to function items"##, | 97 | description: r##"suggest casting to a function pointer when attempting to take references to function items"##, |
100 | }, | 98 | }, |
101 | Lint { | 99 | Lint { |
102 | label: "future-incompatible", | 100 | label: "future_incompatible", |
103 | 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"##, | 101 | 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"##, |
104 | }, | 102 | }, |
105 | Lint { | 103 | Lint { |
106 | label: "ill-formed-attribute-input", | 104 | label: "ill_formed_attribute_input", |
107 | description: r##"ill-formed attribute inputs that were previously accepted and used in practice"##, | 105 | description: r##"ill-formed attribute inputs that were previously accepted and used in practice"##, |
108 | }, | 106 | }, |
109 | Lint { | 107 | Lint { |
110 | label: "illegal-floating-point-literal-pattern", | 108 | label: "illegal_floating_point_literal_pattern", |
111 | description: r##"floating-point literals cannot be used in patterns"##, | 109 | description: r##"floating-point literals cannot be used in patterns"##, |
112 | }, | 110 | }, |
113 | Lint { | 111 | Lint { |
114 | label: "improper-ctypes", | 112 | label: "improper_ctypes", |
115 | description: r##"proper use of libc types in foreign modules"##, | 113 | description: r##"proper use of libc types in foreign modules"##, |
116 | }, | 114 | }, |
117 | Lint { | 115 | Lint { |
118 | label: "improper-ctypes-definitions", | 116 | label: "improper_ctypes_definitions", |
119 | description: r##"proper use of libc types in foreign item definitions"##, | 117 | description: r##"proper use of libc types in foreign item definitions"##, |
120 | }, | 118 | }, |
121 | Lint { | 119 | Lint { |
122 | label: "incomplete-features", | 120 | label: "incomplete_features", |
123 | description: r##"incomplete features that may function improperly in some or all cases"##, | 121 | description: r##"incomplete features that may function improperly in some or all cases"##, |
124 | }, | 122 | }, |
125 | Lint { label: "incomplete-include", description: r##"trailing content in included file"## }, | 123 | Lint { label: "incomplete_include", description: r##"trailing content in included file"## }, |
126 | Lint { | 124 | Lint { |
127 | label: "indirect-structural-match", | 125 | label: "indirect_structural_match", |
128 | description: r##"constant used in pattern contains value of non-structural-match type in a field or a variant"##, | 126 | description: r##"constant used in pattern contains value of non-structural-match type in a field or a variant"##, |
129 | }, | 127 | }, |
130 | Lint { | 128 | Lint { |
131 | label: "ineffective-unstable-trait-impl", | 129 | label: "ineffective_unstable_trait_impl", |
132 | description: r##"detects `#[unstable]` on stable trait implementations for stable types"##, | 130 | description: r##"detects `#[unstable]` on stable trait implementations for stable types"##, |
133 | }, | 131 | }, |
134 | Lint { | 132 | Lint { |
135 | label: "inline-no-sanitize", | 133 | label: "inline_no_sanitize", |
136 | description: r##"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"##, | 134 | description: r##"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"##, |
137 | }, | 135 | }, |
138 | Lint { | 136 | Lint { |
139 | label: "invalid-type-param-default", | 137 | label: "invalid_type_param_default", |
140 | description: r##"type parameter default erroneously allowed in invalid location"##, | 138 | description: r##"type parameter default erroneously allowed in invalid location"##, |
141 | }, | 139 | }, |
142 | Lint { | 140 | Lint { |
143 | label: "invalid-value", | 141 | label: "invalid_value", |
144 | description: r##"an invalid value is being created (such as a null reference)"##, | 142 | description: r##"an invalid value is being created (such as a null reference)"##, |
145 | }, | 143 | }, |
146 | Lint { | 144 | Lint { |
147 | label: "irrefutable-let-patterns", | 145 | label: "irrefutable_let_patterns", |
148 | description: r##"detects irrefutable patterns in `if let` and `while let` statements"##, | 146 | description: r##"detects irrefutable patterns in `if let` and `while let` statements"##, |
149 | }, | 147 | }, |
150 | Lint { | 148 | Lint { |
151 | label: "keyword-idents", | 149 | label: "keyword_idents", |
152 | description: r##"detects edition keywords being used as an identifier"##, | 150 | description: r##"detects edition keywords being used as an identifier"##, |
153 | }, | 151 | }, |
154 | Lint { label: "large-assignments", description: r##"detects large moves or copies"## }, | 152 | Lint { label: "large_assignments", description: r##"detects large moves or copies"## }, |
155 | Lint { | 153 | Lint { |
156 | label: "late-bound-lifetime-arguments", | 154 | label: "late_bound_lifetime_arguments", |
157 | description: r##"detects generic lifetime arguments in path segments with late bound lifetime parameters"##, | 155 | description: r##"detects generic lifetime arguments in path segments with late bound lifetime parameters"##, |
158 | }, | 156 | }, |
159 | Lint { | 157 | Lint { |
160 | label: "legacy-derive-helpers", | 158 | label: "legacy_derive_helpers", |
161 | description: r##"detects derive helper attributes that are used before they are introduced"##, | 159 | description: r##"detects derive helper attributes that are used before they are introduced"##, |
162 | }, | 160 | }, |
163 | Lint { | 161 | Lint { |
164 | label: "macro-expanded-macro-exports-accessed-by-absolute-paths", | 162 | label: "macro_expanded_macro_exports_accessed_by_absolute_paths", |
165 | description: r##"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"##, | 163 | description: r##"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"##, |
166 | }, | 164 | }, |
167 | Lint { | 165 | Lint { |
168 | label: "macro-use-extern-crate", | 166 | label: "macro_use_extern_crate", |
169 | description: r##"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"##, | 167 | description: r##"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"##, |
170 | }, | 168 | }, |
171 | Lint { | 169 | Lint { |
172 | label: "meta-variable-misuse", | 170 | label: "meta_variable_misuse", |
173 | description: r##"possible meta-variable misuse at macro definition"##, | 171 | description: r##"possible meta-variable misuse at macro definition"##, |
174 | }, | 172 | }, |
175 | Lint { label: "missing-abi", description: r##"No declared ABI for extern declaration"## }, | 173 | Lint { label: "missing_abi", description: r##"No declared ABI for extern declaration"## }, |
176 | Lint { | 174 | Lint { |
177 | label: "missing-copy-implementations", | 175 | label: "missing_copy_implementations", |
178 | description: r##"detects potentially-forgotten implementations of `Copy`"##, | 176 | description: r##"detects potentially-forgotten implementations of `Copy`"##, |
179 | }, | 177 | }, |
180 | Lint { | 178 | Lint { |
181 | label: "missing-debug-implementations", | 179 | label: "missing_debug_implementations", |
182 | description: r##"detects missing implementations of Debug"##, | 180 | description: r##"detects missing implementations of Debug"##, |
183 | }, | 181 | }, |
184 | Lint { | 182 | Lint { |
185 | label: "missing-docs", | 183 | label: "missing_docs", |
186 | description: r##"detects missing documentation for public members"##, | 184 | description: r##"detects missing documentation for public members"##, |
187 | }, | 185 | }, |
188 | Lint { | 186 | Lint { |
189 | label: "missing-fragment-specifier", | 187 | label: "missing_fragment_specifier", |
190 | description: r##"detects missing fragment specifiers in unused `macro_rules!` patterns"##, | 188 | description: r##"detects missing fragment specifiers in unused `macro_rules!` patterns"##, |
191 | }, | 189 | }, |
192 | Lint { | 190 | Lint { |
193 | label: "mixed-script-confusables", | 191 | label: "mixed_script_confusables", |
194 | description: r##"detects Unicode scripts whose mixed script confusables codepoints are solely used"##, | 192 | description: r##"detects Unicode scripts whose mixed script confusables codepoints are solely used"##, |
195 | }, | 193 | }, |
196 | Lint { | 194 | Lint { |
197 | label: "mutable-borrow-reservation-conflict", | 195 | label: "mutable_borrow_reservation_conflict", |
198 | description: r##"reservation of a two-phased borrow conflicts with other shared borrows"##, | 196 | description: r##"reservation of a two-phased borrow conflicts with other shared borrows"##, |
199 | }, | 197 | }, |
200 | Lint { | 198 | Lint { |
201 | label: "mutable-transmutes", | 199 | label: "mutable_transmutes", |
202 | description: r##"mutating transmuted &mut T from &T may cause undefined behavior"##, | 200 | description: r##"mutating transmuted &mut T from &T may cause undefined behavior"##, |
203 | }, | 201 | }, |
204 | Lint { | 202 | Lint { |
205 | label: "no-mangle-const-items", | 203 | label: "no_mangle_const_items", |
206 | description: r##"const items will not have their symbols exported"##, | 204 | description: r##"const items will not have their symbols exported"##, |
207 | }, | 205 | }, |
208 | Lint { label: "no-mangle-generic-items", description: r##"generic items must be mangled"## }, | 206 | Lint { label: "no_mangle_generic_items", description: r##"generic items must be mangled"## }, |
209 | Lint { label: "non-ascii-idents", description: r##"detects non-ASCII identifiers"## }, | 207 | Lint { label: "non_ascii_idents", description: r##"detects non-ASCII identifiers"## }, |
210 | Lint { | 208 | Lint { |
211 | label: "non-camel-case-types", | 209 | label: "non_camel_case_types", |
212 | description: r##"types, variants, traits and type parameters should have camel case names"##, | 210 | description: r##"types, variants, traits and type parameters should have camel case names"##, |
213 | }, | 211 | }, |
214 | Lint { | 212 | Lint { |
215 | label: "non-fmt-panic", | 213 | label: "non_fmt_panic", |
216 | description: r##"detect single-argument panic!() invocations in which the argument is not a format string"##, | 214 | description: r##"detect single-argument panic!() invocations in which the argument is not a format string"##, |
217 | }, | 215 | }, |
218 | Lint { | 216 | Lint { |
219 | label: "non-shorthand-field-patterns", | 217 | label: "non_shorthand_field_patterns", |
220 | description: r##"using `Struct { x: x }` instead of `Struct { x }` in a pattern"##, | 218 | description: r##"using `Struct { x: x }` instead of `Struct { x }` in a pattern"##, |
221 | }, | 219 | }, |
222 | Lint { | 220 | Lint { |
223 | label: "non-snake-case", | 221 | label: "non_snake_case", |
224 | description: r##"variables, methods, functions, lifetime parameters and modules should have snake case names"##, | 222 | description: r##"variables, methods, functions, lifetime parameters and modules should have snake case names"##, |
225 | }, | 223 | }, |
226 | Lint { | 224 | Lint { |
227 | label: "non-upper-case-globals", | 225 | label: "non_upper_case_globals", |
228 | description: r##"static constants should have uppercase identifiers"##, | 226 | description: r##"static constants should have uppercase identifiers"##, |
229 | }, | 227 | }, |
230 | Lint { | 228 | Lint { |
231 | label: "nonstandard-style", | 229 | label: "nonstandard_style", |
232 | description: r##"lint group for: non-camel-case-types, non-snake-case, non-upper-case-globals"##, | 230 | description: r##"lint group for: non-camel-case-types, non-snake-case, non-upper-case-globals"##, |
233 | }, | 231 | }, |
234 | Lint { | 232 | Lint { |
235 | label: "nontrivial-structural-match", | 233 | label: "nontrivial_structural_match", |
236 | description: r##"constant used in pattern of non-structural-match type and the constant's initializer expression contains values of non-structural-match types"##, | 234 | description: r##"constant used in pattern of non-structural-match type and the constant's initializer expression contains values of non-structural-match types"##, |
237 | }, | 235 | }, |
238 | Lint { | 236 | Lint { |
239 | label: "noop-method-call", | 237 | label: "noop_method_call", |
240 | description: r##"detects the use of well-known noop methods"##, | 238 | description: r##"detects the use of well-known noop methods"##, |
241 | }, | 239 | }, |
242 | Lint { | 240 | Lint { |
243 | label: "or-patterns-back-compat", | 241 | label: "or_patterns_back_compat", |
244 | description: r##"detects usage of old versions of or-patterns"##, | 242 | description: r##"detects usage of old versions of or-patterns"##, |
245 | }, | 243 | }, |
246 | Lint { | 244 | Lint { |
247 | label: "order-dependent-trait-objects", | 245 | label: "order_dependent_trait_objects", |
248 | description: r##"trait-object types were treated as different depending on marker-trait order"##, | 246 | description: r##"trait-object types were treated as different depending on marker-trait order"##, |
249 | }, | 247 | }, |
250 | Lint { label: "overflowing-literals", description: r##"literal out of range for its type"## }, | 248 | Lint { label: "overflowing_literals", description: r##"literal out of range for its type"## }, |
251 | Lint { | 249 | Lint { |
252 | label: "overlapping-range-endpoints", | 250 | label: "overlapping_range_endpoints", |
253 | description: r##"detects range patterns with overlapping endpoints"##, | 251 | description: r##"detects range patterns with overlapping endpoints"##, |
254 | }, | 252 | }, |
255 | Lint { label: "path-statements", description: r##"path statements with no effect"## }, | 253 | Lint { label: "path_statements", description: r##"path statements with no effect"## }, |
256 | Lint { | 254 | Lint { |
257 | label: "patterns-in-fns-without-body", | 255 | label: "patterns_in_fns_without_body", |
258 | description: r##"patterns in functions without body were erroneously allowed"##, | 256 | description: r##"patterns in functions without body were erroneously allowed"##, |
259 | }, | 257 | }, |
260 | Lint { | 258 | Lint { |
261 | label: "pointer-structural-match", | 259 | label: "pointer_structural_match", |
262 | description: r##"pointers are not structural-match"##, | 260 | description: r##"pointers are not structural-match"##, |
263 | }, | 261 | }, |
264 | Lint { | 262 | Lint { |
265 | label: "private-in-public", | 263 | label: "private_in_public", |
266 | description: r##"detect private items in public interfaces not caught by the old implementation"##, | 264 | description: r##"detect private items in public interfaces not caught by the old implementation"##, |
267 | }, | 265 | }, |
268 | Lint { | 266 | Lint { |
269 | label: "proc-macro-back-compat", | 267 | label: "proc_macro_back_compat", |
270 | description: r##"detects usage of old versions of certain proc-macro crates"##, | 268 | description: r##"detects usage of old versions of certain proc-macro crates"##, |
271 | }, | 269 | }, |
272 | Lint { | 270 | Lint { |
273 | label: "proc-macro-derive-resolution-fallback", | 271 | label: "proc_macro_derive_resolution_fallback", |
274 | description: r##"detects proc macro derives using inaccessible names from parent modules"##, | 272 | description: r##"detects proc macro derives using inaccessible names from parent modules"##, |
275 | }, | 273 | }, |
276 | Lint { | 274 | Lint { |
277 | label: "pub-use-of-private-extern-crate", | 275 | label: "pub_use_of_private_extern_crate", |
278 | description: r##"detect public re-exports of private extern crates"##, | 276 | description: r##"detect public re-exports of private extern crates"##, |
279 | }, | 277 | }, |
280 | Lint { | 278 | Lint { |
281 | label: "redundant-semicolons", | 279 | label: "redundant_semicolons", |
282 | description: r##"detects unnecessary trailing semicolons"##, | 280 | description: r##"detects unnecessary trailing semicolons"##, |
283 | }, | 281 | }, |
284 | Lint { | 282 | Lint { |
285 | label: "renamed-and-removed-lints", | 283 | label: "renamed_and_removed_lints", |
286 | description: r##"lints that have been renamed or removed"##, | 284 | description: r##"lints that have been renamed or removed"##, |
287 | }, | 285 | }, |
288 | Lint { | 286 | Lint { |
289 | label: "rust-2018-compatibility", | 287 | label: "rust_2018_compatibility", |
290 | description: r##"lint group for: keyword-idents, anonymous-parameters, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate"##, | 288 | description: r##"lint group for: keyword-idents, anonymous-parameters, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate"##, |
291 | }, | 289 | }, |
292 | Lint { | 290 | Lint { |
293 | label: "rust-2018-idioms", | 291 | label: "rust_2018_idioms", |
294 | description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##, | 292 | description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##, |
295 | }, | 293 | }, |
296 | Lint { | 294 | Lint { |
297 | label: "rust-2021-compatibility", | 295 | label: "rust_2021_compatibility", |
298 | description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##, | 296 | description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##, |
299 | }, | 297 | }, |
300 | Lint { | 298 | Lint { |
301 | label: "semicolon-in-expressions-from-macros", | 299 | label: "semicolon_in_expressions_from_macros", |
302 | description: r##"trailing semicolon in macro body used as expression"##, | 300 | description: r##"trailing semicolon in macro body used as expression"##, |
303 | }, | 301 | }, |
304 | Lint { | 302 | Lint { |
305 | label: "single-use-lifetimes", | 303 | label: "single_use_lifetimes", |
306 | description: r##"detects lifetime parameters that are only used once"##, | 304 | description: r##"detects lifetime parameters that are only used once"##, |
307 | }, | 305 | }, |
308 | Lint { | 306 | Lint { |
309 | label: "soft-unstable", | 307 | label: "soft_unstable", |
310 | description: r##"a feature gate that doesn't break dependent crates"##, | 308 | description: r##"a feature gate that doesn't break dependent crates"##, |
311 | }, | 309 | }, |
312 | Lint { | 310 | Lint { |
313 | label: "stable-features", | 311 | label: "stable_features", |
314 | description: r##"stable features found in `#[feature]` directive"##, | 312 | description: r##"stable features found in `#[feature]` directive"##, |
315 | }, | 313 | }, |
316 | Lint { | 314 | Lint { |
317 | label: "temporary-cstring-as-ptr", | 315 | label: "temporary_cstring_as_ptr", |
318 | description: r##"detects getting the inner pointer of a temporary `CString`"##, | 316 | description: r##"detects getting the inner pointer of a temporary `CString`"##, |
319 | }, | 317 | }, |
320 | Lint { | 318 | Lint { |
321 | label: "trivial-bounds", | 319 | label: "trivial_bounds", |
322 | description: r##"these bounds don't depend on an type parameters"##, | 320 | description: r##"these bounds don't depend on an type parameters"##, |
323 | }, | 321 | }, |
324 | Lint { | 322 | Lint { |
325 | label: "trivial-casts", | 323 | label: "trivial_casts", |
326 | description: r##"detects trivial casts which could be removed"##, | 324 | description: r##"detects trivial casts which could be removed"##, |
327 | }, | 325 | }, |
328 | Lint { | 326 | Lint { |
329 | label: "trivial-numeric-casts", | 327 | label: "trivial_numeric_casts", |
330 | description: r##"detects trivial casts of numeric types which could be removed"##, | 328 | description: r##"detects trivial casts of numeric types which could be removed"##, |
331 | }, | 329 | }, |
332 | Lint { | 330 | Lint { |
333 | label: "type-alias-bounds", | 331 | label: "type_alias_bounds", |
334 | description: r##"bounds in type aliases are not enforced"##, | 332 | description: r##"bounds in type aliases are not enforced"##, |
335 | }, | 333 | }, |
336 | Lint { | 334 | Lint { |
337 | label: "tyvar-behind-raw-pointer", | 335 | label: "tyvar_behind_raw_pointer", |
338 | description: r##"raw pointer to an inference variable"##, | 336 | description: r##"raw pointer to an inference variable"##, |
339 | }, | 337 | }, |
340 | Lint { | 338 | Lint { |
341 | label: "unaligned-references", | 339 | label: "unaligned_references", |
342 | description: r##"detects unaligned references to fields of packed structs"##, | 340 | description: r##"detects unaligned references to fields of packed structs"##, |
343 | }, | 341 | }, |
344 | Lint { | 342 | Lint { |
345 | label: "uncommon-codepoints", | 343 | label: "uncommon_codepoints", |
346 | description: r##"detects uncommon Unicode codepoints in identifiers"##, | 344 | description: r##"detects uncommon Unicode codepoints in identifiers"##, |
347 | }, | 345 | }, |
348 | Lint { | 346 | Lint { |
349 | label: "unconditional-panic", | 347 | label: "unconditional_panic", |
350 | description: r##"operation will cause a panic at runtime"##, | 348 | description: r##"operation will cause a panic at runtime"##, |
351 | }, | 349 | }, |
352 | Lint { | 350 | Lint { |
353 | label: "unconditional-recursion", | 351 | label: "unconditional_recursion", |
354 | description: r##"functions that cannot return without calling themselves"##, | 352 | description: r##"functions that cannot return without calling themselves"##, |
355 | }, | 353 | }, |
356 | Lint { label: "uninhabited-static", description: r##"uninhabited static"## }, | 354 | Lint { label: "uninhabited_static", description: r##"uninhabited static"## }, |
357 | Lint { | 355 | Lint { |
358 | label: "unknown-crate-types", | 356 | label: "unknown_crate_types", |
359 | description: r##"unknown crate type found in `#[crate_type]` directive"##, | 357 | description: r##"unknown crate type found in `#[crate_type]` directive"##, |
360 | }, | 358 | }, |
361 | Lint { label: "unknown-lints", description: r##"unrecognized lint attribute"## }, | 359 | Lint { label: "unknown_lints", description: r##"unrecognized lint attribute"## }, |
362 | Lint { | 360 | Lint { |
363 | label: "unnameable-test-items", | 361 | label: "unnameable_test_items", |
364 | description: r##"detects an item that cannot be named being marked as `#[test_case]`"##, | 362 | description: r##"detects an item that cannot be named being marked as `#[test_case]`"##, |
365 | }, | 363 | }, |
366 | Lint { label: "unreachable-code", description: r##"detects unreachable code paths"## }, | 364 | Lint { label: "unreachable_code", description: r##"detects unreachable code paths"## }, |
367 | Lint { label: "unreachable-patterns", description: r##"detects unreachable patterns"## }, | 365 | Lint { label: "unreachable_patterns", description: r##"detects unreachable patterns"## }, |
368 | Lint { | 366 | Lint { |
369 | label: "unreachable-pub", | 367 | label: "unreachable_pub", |
370 | description: r##"`pub` items not reachable from crate root"##, | 368 | description: r##"`pub` items not reachable from crate root"##, |
371 | }, | 369 | }, |
372 | Lint { label: "unsafe-code", description: r##"usage of `unsafe` code"## }, | 370 | Lint { label: "unsafe_code", description: r##"usage of `unsafe` code"## }, |
373 | Lint { | 371 | Lint { |
374 | label: "unsafe-op-in-unsafe-fn", | 372 | label: "unsafe_op_in_unsafe_fn", |
375 | description: r##"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"##, | 373 | description: r##"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"##, |
376 | }, | 374 | }, |
377 | Lint { | 375 | Lint { |
378 | label: "unstable-features", | 376 | label: "unstable_features", |
379 | description: r##"enabling unstable features (deprecated. do not use)"##, | 377 | description: r##"enabling unstable features (deprecated. do not use)"##, |
380 | }, | 378 | }, |
381 | Lint { | 379 | Lint { |
382 | label: "unstable-name-collisions", | 380 | label: "unstable_name_collisions", |
383 | description: r##"detects name collision with an existing but unstable method"##, | 381 | description: r##"detects name collision with an existing but unstable method"##, |
384 | }, | 382 | }, |
385 | Lint { | 383 | Lint { |
386 | label: "unsupported-naked-functions", | 384 | label: "unsupported_naked_functions", |
387 | description: r##"unsupported naked function definitions"##, | 385 | description: r##"unsupported naked function definitions"##, |
388 | }, | 386 | }, |
389 | Lint { | 387 | Lint { |
@@ -391,77 +389,77 @@ pub const DEFAULT_LINTS: &[Lint] = &[ | |||
391 | 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"##, | 389 | 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"##, |
392 | }, | 390 | }, |
393 | Lint { | 391 | Lint { |
394 | label: "unused-allocation", | 392 | label: "unused_allocation", |
395 | description: r##"detects unnecessary allocations that can be eliminated"##, | 393 | description: r##"detects unnecessary allocations that can be eliminated"##, |
396 | }, | 394 | }, |
397 | Lint { | 395 | Lint { |
398 | label: "unused-assignments", | 396 | label: "unused_assignments", |
399 | description: r##"detect assignments that will never be read"##, | 397 | description: r##"detect assignments that will never be read"##, |
400 | }, | 398 | }, |
401 | Lint { | 399 | Lint { |
402 | label: "unused-attributes", | 400 | label: "unused_attributes", |
403 | description: r##"detects attributes that were not used by the compiler"##, | 401 | description: r##"detects attributes that were not used by the compiler"##, |
404 | }, | 402 | }, |
405 | Lint { label: "unused-braces", description: r##"unnecessary braces around an expression"## }, | 403 | Lint { label: "unused_braces", description: r##"unnecessary braces around an expression"## }, |
406 | Lint { | 404 | Lint { |
407 | label: "unused-comparisons", | 405 | label: "unused_comparisons", |
408 | description: r##"comparisons made useless by limits of the types involved"##, | 406 | description: r##"comparisons made useless by limits of the types involved"##, |
409 | }, | 407 | }, |
410 | Lint { | 408 | Lint { |
411 | label: "unused-crate-dependencies", | 409 | label: "unused_crate_dependencies", |
412 | description: r##"crate dependencies that are never used"##, | 410 | description: r##"crate dependencies that are never used"##, |
413 | }, | 411 | }, |
414 | Lint { | 412 | Lint { |
415 | label: "unused-doc-comments", | 413 | label: "unused_doc_comments", |
416 | description: r##"detects doc comments that aren't used by rustdoc"##, | 414 | description: r##"detects doc comments that aren't used by rustdoc"##, |
417 | }, | 415 | }, |
418 | Lint { label: "unused-extern-crates", description: r##"extern crates that are never used"## }, | 416 | Lint { label: "unused_extern_crates", description: r##"extern crates that are never used"## }, |
419 | Lint { | 417 | Lint { |
420 | label: "unused-features", | 418 | label: "unused_features", |
421 | description: r##"unused features found in crate-level `#[feature]` directives"##, | 419 | description: r##"unused features found in crate-level `#[feature]` directives"##, |
422 | }, | 420 | }, |
423 | Lint { | 421 | Lint { |
424 | label: "unused-import-braces", | 422 | label: "unused_import_braces", |
425 | description: r##"unnecessary braces around an imported item"##, | 423 | description: r##"unnecessary braces around an imported item"##, |
426 | }, | 424 | }, |
427 | Lint { label: "unused-imports", description: r##"imports that are never used"## }, | 425 | Lint { label: "unused_imports", description: r##"imports that are never used"## }, |
428 | Lint { label: "unused-labels", description: r##"detects labels that are never used"## }, | 426 | Lint { label: "unused_labels", description: r##"detects labels that are never used"## }, |
429 | Lint { | 427 | Lint { |
430 | label: "unused-lifetimes", | 428 | label: "unused_lifetimes", |
431 | description: r##"detects lifetime parameters that are never used"##, | 429 | description: r##"detects lifetime parameters that are never used"##, |
432 | }, | 430 | }, |
433 | Lint { label: "unused-macros", description: r##"detects macros that were not used"## }, | 431 | Lint { label: "unused_macros", description: r##"detects macros that were not used"## }, |
434 | Lint { | 432 | Lint { |
435 | label: "unused-must-use", | 433 | label: "unused_must_use", |
436 | description: r##"unused result of a type flagged as `#[must_use]`"##, | 434 | description: r##"unused result of a type flagged as `#[must_use]`"##, |
437 | }, | 435 | }, |
438 | Lint { | 436 | Lint { |
439 | label: "unused-mut", | 437 | label: "unused_mut", |
440 | description: r##"detect mut variables which don't need to be mutable"##, | 438 | description: r##"detect mut variables which don't need to be mutable"##, |
441 | }, | 439 | }, |
442 | Lint { | 440 | Lint { |
443 | label: "unused-parens", | 441 | label: "unused_parens", |
444 | description: r##"`if`, `match`, `while` and `return` do not need parentheses"##, | 442 | description: r##"`if`, `match`, `while` and `return` do not need parentheses"##, |
445 | }, | 443 | }, |
446 | Lint { | 444 | Lint { |
447 | label: "unused-qualifications", | 445 | label: "unused_qualifications", |
448 | description: r##"detects unnecessarily qualified names"##, | 446 | description: r##"detects unnecessarily qualified names"##, |
449 | }, | 447 | }, |
450 | Lint { | 448 | Lint { |
451 | label: "unused-results", | 449 | label: "unused_results", |
452 | description: r##"unused result of an expression in a statement"##, | 450 | description: r##"unused result of an expression in a statement"##, |
453 | }, | 451 | }, |
454 | Lint { label: "unused-unsafe", description: r##"unnecessary use of an `unsafe` block"## }, | 452 | Lint { label: "unused_unsafe", description: r##"unnecessary use of an `unsafe` block"## }, |
455 | Lint { | 453 | Lint { |
456 | label: "unused-variables", | 454 | label: "unused_variables", |
457 | description: r##"detect variables which are not used in any way"##, | 455 | description: r##"detect variables which are not used in any way"##, |
458 | }, | 456 | }, |
459 | Lint { | 457 | Lint { |
460 | label: "useless-deprecated", | 458 | label: "useless_deprecated", |
461 | description: r##"detects deprecation attributes with no effect"##, | 459 | description: r##"detects deprecation attributes with no effect"##, |
462 | }, | 460 | }, |
463 | Lint { | 461 | Lint { |
464 | label: "variant-size-differences", | 462 | label: "variant_size_differences", |
465 | description: r##"detects enums with widely varying variant sizes"##, | 463 | description: r##"detects enums with widely varying variant sizes"##, |
466 | }, | 464 | }, |
467 | Lint { | 465 | Lint { |
@@ -473,11 +471,11 @@ pub const DEFAULT_LINTS: &[Lint] = &[ | |||
473 | description: r##"lint group for: all lints that are set to issue warnings"##, | 471 | description: r##"lint group for: all lints that are set to issue warnings"##, |
474 | }, | 472 | }, |
475 | Lint { | 473 | Lint { |
476 | label: "where-clauses-object-safety", | 474 | label: "where_clauses_object_safety", |
477 | description: r##"checks the object safety of where clauses"##, | 475 | description: r##"checks the object safety of where clauses"##, |
478 | }, | 476 | }, |
479 | Lint { | 477 | Lint { |
480 | label: "while-true", | 478 | label: "while_true", |
481 | description: r##"suggest using `loop { }` instead of `while true { }`"##, | 479 | description: r##"suggest using `loop { }` instead of `while true { }`"##, |
482 | }, | 480 | }, |
483 | ]; | 481 | ]; |
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs index b797067cd..a28b6cb59 100644 --- a/xtask/src/codegen/gen_lint_completions.rs +++ b/xtask/src/codegen/gen_lint_completions.rs | |||
@@ -52,6 +52,7 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> { | |||
52 | buf.push('\n'); | 52 | buf.push('\n'); |
53 | let mut lints = stdout[start_lints..end_lints] | 53 | let mut lints = stdout[start_lints..end_lints] |
54 | .lines() | 54 | .lines() |
55 | .skip(1) | ||
55 | .filter(|l| !l.is_empty()) | 56 | .filter(|l| !l.is_empty()) |
56 | .map(|line| { | 57 | .map(|line| { |
57 | let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap(); | 58 | let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap(); |
@@ -60,15 +61,19 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> { | |||
60 | (name.trim(), Cow::Borrowed(description.trim())) | 61 | (name.trim(), Cow::Borrowed(description.trim())) |
61 | }) | 62 | }) |
62 | .collect::<Vec<_>>(); | 63 | .collect::<Vec<_>>(); |
63 | lints.extend(stdout[start_lint_groups..end_lint_groups].lines().filter(|l| !l.is_empty()).map( | 64 | lints.extend( |
64 | |line| { | 65 | stdout[start_lint_groups..end_lint_groups].lines().skip(1).filter(|l| !l.is_empty()).map( |
65 | let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap(); | 66 | |line| { |
66 | (name.trim(), format!("lint group for: {}", lints.trim()).into()) | 67 | let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap(); |
67 | }, | 68 | (name.trim(), format!("lint group for: {}", lints.trim()).into()) |
68 | )); | 69 | }, |
70 | ), | ||
71 | ); | ||
69 | 72 | ||
70 | lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2)); | 73 | lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2)); |
71 | lints.into_iter().for_each(|(name, description)| push_lint_completion(buf, name, &description)); | 74 | lints.into_iter().for_each(|(name, description)| { |
75 | push_lint_completion(buf, &name.replace("-", "_"), &description) | ||
76 | }); | ||
72 | buf.push_str("];\n"); | 77 | buf.push_str("];\n"); |
73 | Ok(()) | 78 | Ok(()) |
74 | } | 79 | } |