You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #7525 - xFrednet:7172-update-define-conf-macro, r=flip1995
Updated `define_Conf!` to support multi-line doc comments
Updated the `define_Conf!` macro to support multi-line doc comments for readability. This also enables configuration documentation to have multiple paragraphs.
I've also added the `metadata-collector-lint` feature to the CI build and testing tasks. (I would think that we want this, now that we officially switched over)
---
Now a small informal explanation what this PR changes (just for fun):
* *Once upon a time there was a monster. It was handsome, supportive and happy to dig through the best source code it has ever seen. Spanning over hundreds of lines and reading over complete crates, it was purely marvels!*
*However, there was one region in its territory that wasn't clean and well formatted like the rest. That was the mighty `define_Conf` macro. The monster would have cleaned it up a long time ago but, the previous ruler of this kingdom a powerful Python script was prohibiting it. But now that the old king was slain in the great battle of rust-1.54.0, everything was possible again. Our lovely monster was now able to grab its cleaning equipment and get some nice formatting into the now unprotected area.*
*Said and done! Let this day go down in history!*
(I'll be the first to admit, that I'm a bit lost today. And I'm also procrastinating on some other discussions where I have some catching up to do... Oh, well, this was fun)
---
changelog: none
r? `@flip1995`
/// Lint: ENUM_VARIANT_NAMES, LARGE_TYPES_PASSED_BY_VALUE, TRIVIALLY_COPY_PASS_BY_REF, UNNECESSARY_WRAPS, UPPER_CASE_ACRONYMS, WRONG_SELF_CONVENTION. Suppress lints whenever the suggested change would cause breakage for other crates.
/// Lint: DOC_MARKDOWN. The list of words this lint should not consider as identifiers needing ticks
156
+
/// Lint: DOC_MARKDOWN.
157
+
///
158
+
/// The list of words this lint should not consider as identifiers needing ticks
147
159
(doc_valid_idents:Vec<String> = [
148
160
"KiB","MiB","GiB","TiB","PiB","EiB",
149
161
"DirectX",
@@ -164,55 +176,109 @@ define_Conf! {
164
176
"MinGW",
165
177
"CamelCase",
166
178
].iter().map(ToString::to_string).collect()),
167
-
/// Lint: TOO_MANY_ARGUMENTS. The maximum number of argument a function or method can have
179
+
/// Lint: TOO_MANY_ARGUMENTS.
180
+
///
181
+
/// The maximum number of argument a function or method can have
168
182
(too_many_arguments_threshold:u64 = 7),
169
-
/// Lint: TYPE_COMPLEXITY. The maximum complexity a type can have
183
+
/// Lint: TYPE_COMPLEXITY.
184
+
///
185
+
/// The maximum complexity a type can have
170
186
(type_complexity_threshold:u64 = 250),
171
-
/// Lint: MANY_SINGLE_CHAR_NAMES. The maximum number of single char bindings a scope may have
187
+
/// Lint: MANY_SINGLE_CHAR_NAMES.
188
+
///
189
+
/// The maximum number of single char bindings a scope may have
172
190
(single_char_binding_names_threshold:u64 = 4),
173
-
/// Lint: BOXED_LOCAL, USELESS_VEC. The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
191
+
/// Lint: BOXED_LOCAL, USELESS_VEC.
192
+
///
193
+
/// The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
174
194
(too_large_for_stack:u64 = 200),
175
-
/// Lint: ENUM_VARIANT_NAMES. The minimum number of enum variants for the lints about variant names to trigger
195
+
/// Lint: ENUM_VARIANT_NAMES.
196
+
///
197
+
/// The minimum number of enum variants for the lints about variant names to trigger
176
198
(enum_variant_name_threshold:u64 = 3),
177
-
/// Lint: LARGE_ENUM_VARIANT. The maximum size of a enum's variant to avoid box suggestion
199
+
/// Lint: LARGE_ENUM_VARIANT.
200
+
///
201
+
/// The maximum size of a enum's variant to avoid box suggestion
178
202
(enum_variant_size_threshold:u64 = 200),
179
-
/// Lint: VERBOSE_BIT_MASK. The maximum allowed size of a bit mask before suggesting to use 'trailing_zeros'
203
+
/// Lint: VERBOSE_BIT_MASK.
204
+
///
205
+
/// The maximum allowed size of a bit mask before suggesting to use 'trailing_zeros'
180
206
(verbose_bit_mask_threshold:u64 = 1),
181
-
/// Lint: DECIMAL_LITERAL_REPRESENTATION. The lower bound for linting decimal literals
207
+
/// Lint: DECIMAL_LITERAL_REPRESENTATION.
208
+
///
209
+
/// The lower bound for linting decimal literals
182
210
(literal_representation_threshold:u64 = 16384),
183
-
/// Lint: TRIVIALLY_COPY_PASS_BY_REF. The maximum size (in bytes) to consider a `Copy` type for passing by value instead of by reference.
211
+
/// Lint: TRIVIALLY_COPY_PASS_BY_REF.
212
+
///
213
+
/// The maximum size (in bytes) to consider a `Copy` type for passing by value instead of by reference.
184
214
(trivial_copy_size_limit:Option<u64> = None),
185
-
/// Lint: LARGE_TYPE_PASS_BY_MOVE. The minimum size (in bytes) to consider a type for passing by reference instead of by value.
215
+
/// Lint: LARGE_TYPE_PASS_BY_MOVE.
216
+
///
217
+
/// The minimum size (in bytes) to consider a type for passing by reference instead of by value.
186
218
(pass_by_value_size_limit:u64 = 256),
187
-
/// Lint: TOO_MANY_LINES. The maximum number of lines a function or method can have
219
+
/// Lint: TOO_MANY_LINES.
220
+
///
221
+
/// The maximum number of lines a function or method can have
188
222
(too_many_lines_threshold:u64 = 100),
189
-
/// Lint: LARGE_STACK_ARRAYS, LARGE_CONST_ARRAYS. The maximum allowed size for arrays on the stack
223
+
/// Lint: LARGE_STACK_ARRAYS, LARGE_CONST_ARRAYS.
224
+
///
225
+
/// The maximum allowed size for arrays on the stack
190
226
(array_size_threshold:u64 = 512_000),
191
-
/// Lint: VEC_BOX. The size of the boxed type in bytes, where boxing in a `Vec` is allowed
227
+
/// Lint: VEC_BOX.
228
+
///
229
+
/// The size of the boxed type in bytes, where boxing in a `Vec` is allowed
192
230
(vec_box_size_threshold:u64 = 4096),
193
-
/// Lint: TYPE_REPETITION_IN_BOUNDS. The maximum number of bounds a trait can have to be linted
231
+
/// Lint: TYPE_REPETITION_IN_BOUNDS.
232
+
///
233
+
/// The maximum number of bounds a trait can have to be linted
194
234
(max_trait_bounds:u64 = 3),
195
-
/// Lint: STRUCT_EXCESSIVE_BOOLS. The maximum number of bool fields a struct can have
235
+
/// Lint: STRUCT_EXCESSIVE_BOOLS.
236
+
///
237
+
/// The maximum number of bool fields a struct can have
196
238
(max_struct_bools:u64 = 3),
197
-
/// Lint: FN_PARAMS_EXCESSIVE_BOOLS. The maximum number of bool parameters a function can have
239
+
/// Lint: FN_PARAMS_EXCESSIVE_BOOLS.
240
+
///
241
+
/// The maximum number of bool parameters a function can have
198
242
(max_fn_params_bools:u64 = 3),
199
-
/// Lint: WILDCARD_IMPORTS. Whether to allow certain wildcard imports (prelude, super in tests).
243
+
/// Lint: WILDCARD_IMPORTS.
244
+
///
245
+
/// Whether to allow certain wildcard imports (prelude, super in tests).
200
246
(warn_on_all_wildcard_imports:bool = false),
201
-
/// Lint: DISALLOWED_METHOD. The list of disallowed methods, written as fully qualified paths.
247
+
/// Lint: DISALLOWED_METHOD.
248
+
///
249
+
/// The list of disallowed methods, written as fully qualified paths.
202
250
(disallowed_methods:Vec<String> = Vec::new()),
203
-
/// Lint: DISALLOWED_TYPE. The list of disallowed types, written as fully qualified paths.
251
+
/// Lint: DISALLOWED_TYPE.
252
+
///
253
+
/// The list of disallowed types, written as fully qualified paths.
204
254
(disallowed_types:Vec<String> = Vec::new()),
205
-
/// Lint: UNREADABLE_LITERAL. Should the fraction of a decimal be linted to include separators.
255
+
/// Lint: UNREADABLE_LITERAL.
256
+
///
257
+
/// Should the fraction of a decimal be linted to include separators.
206
258
(unreadable_literal_lint_fractions:bool = true),
207
-
/// Lint: UPPER_CASE_ACRONYMS. Enables verbose mode. Triggers if there is more than one uppercase char next to each other
259
+
/// Lint: UPPER_CASE_ACRONYMS.
260
+
///
261
+
/// Enables verbose mode. Triggers if there is more than one uppercase char next to each other
208
262
(upper_case_acronyms_aggressive:bool = false),
209
-
/// Lint: _CARGO_COMMON_METADATA. For internal testing only, ignores the current `publish` settings in the Cargo manifest.
263
+
/// Lint: _CARGO_COMMON_METADATA.
264
+
///
265
+
/// For internal testing only, ignores the current `publish` settings in the Cargo manifest.
210
266
(cargo_ignore_publish:bool = false),
211
-
/// Lint: NONSTANDARD_MACRO_BRACES. Enforce the named macros always use the braces specified. <br> A `MacroMatcher` can be added like so `{ name = "macro_name", brace = "(" }`. If the macro is could be used with a full path two `MacroMatcher`s have to be added one with the full path `crate_name::macro_name` and one with just the macro name.
267
+
/// Lint: NONSTANDARD_MACRO_BRACES.
268
+
///
269
+
/// Enforce the named macros always use the braces specified.
270
+
///
271
+
/// A `MacroMatcher` can be added like so `{ name = "macro_name", brace = "(" }`. If the macro
272
+
/// is could be used with a full path two `MacroMatcher`s have to be added one with the full path
273
+
/// `crate_name::macro_name` and one with just the macro name.
0 commit comments