Skip to content

Commit 86bf28d

Browse files
committed
Auto merge of #7385 - xFrednet:0000-fix-broken-deploy, r=flip1995
Fixed broken deploy script due to multiline configuration docs The deploy script on master currently runs into an error (See [log](https://github.com/rust-lang/rust-clippy/runs/2865828873)) due to the new configuration documentation added in #7299. The current documentation collection for the configuration macro sadly doesn't support multiline doc comments. This will be changes in the future with the new metadata collector tracked in #7172 For now we have to use `<br>` inside doc comments to add paragraphs. This PR restricts `define_Conf!` macro to single lines and adds a comment explaining the reasoning behind it. It also adjusted the actual document parsing to fix a bug. (The parsing was automatically stopping on the first curly bracket, even if it was part of a doc comment). changelog: none
2 parents 404bd1a + 96a9786 commit 86bf28d

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

clippy_lints/src/utils/conf.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ impl TryConf {
2424
}
2525
}
2626

27+
/// Note that the configuration parsing currently doesn't support documentation that will
28+
/// that spans over several lines. This will be possible with the new implementation
29+
/// See (rust-clippy#7172)
2730
macro_rules! define_Conf {
2831
($(
29-
$(#[doc = $doc:literal])*
32+
#[doc = $doc:literal]
3033
$(#[conf_deprecated($dep:literal)])?
3134
($name:ident: $ty:ty = $default:expr),
3235
)*) => {
3336
/// Clippy lint configuration
3437
pub struct Conf {
35-
$($(#[doc = $doc])* pub $name: $ty,)*
38+
$(#[doc = $doc] pub $name: $ty,)*
3639
}
3740

3841
mod defaults {
@@ -109,7 +112,7 @@ macro_rules! define_Conf {
109112
stringify!($name),
110113
stringify!($ty),
111114
format!("{:?}", super::defaults::$name()),
112-
concat!($($doc,)*),
115+
$doc,
113116
deprecation_reason,
114117
)
115118
},
@@ -198,11 +201,7 @@ define_Conf! {
198201
(upper_case_acronyms_aggressive: bool = false),
199202
/// Lint: _CARGO_COMMON_METADATA. For internal testing only, ignores the current `publish` settings in the Cargo manifest.
200203
(cargo_ignore_publish: bool = false),
201-
/// Lint: NONSTANDARD_MACRO_BRACES. Enforce the named macros always use the braces specified.
202-
///
203-
/// A `MacroMatcher` can be added like so `{ name = "macro_name", brace = "(" }`.
204-
/// If the macro is could be used with a full path two `MacroMatcher`s have to be added one
205-
/// with the full path `crate_name::macro_name` and one with just the macro name.
204+
/// 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.
206205
(standard_macro_braces: Vec<crate::nonstandard_macro_braces::MacroMatcher> = Vec::new()),
207206
}
208207

util/lintlib.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
lintname_re = re.compile(r'''pub\s+([A-Z_][A-Z_0-9]*)''')
1414
group_re = re.compile(r'''\s*([a-z_][a-z_0-9]+)''')
15-
conf_re = re.compile(r'''define_Conf! {\n([^}]*)\n}''', re.MULTILINE)
15+
conf_re = re.compile(r'''define_Conf! {\n((?!\n})[\s\S])*\n}''', re.MULTILINE)
1616
confvar_re = re.compile(
1717
r'''/// Lint: ([\w,\s]+)\. (.*)\n\s*\(([^:]+):\s*([^\s=]+)\s*=\s*([^\.\)]+).*\),''', re.MULTILINE)
1818
comment_re = re.compile(r'''\s*/// ?(.*)''')
@@ -91,7 +91,7 @@ def parse_configs(path):
9191
contents = fp.read()
9292

9393
match = re.search(conf_re, contents)
94-
confvars = re.findall(confvar_re, match.group(1))
94+
confvars = re.findall(confvar_re, match.group(0))
9595

9696
for (lints, doc, name, ty, default) in confvars:
9797
for lint in lints.split(','):

0 commit comments

Comments
 (0)