Skip to content

Commit

Permalink
Auto merge of #12088 - granddaifuku:fix/metadata-collector-lint-listi…
Browse files Browse the repository at this point in the history
…ng, r=Manishearth

fix: metadata-collector lists wrong affected lints

fixes #12042

This PR addresses the issue where the `metadata collector` incorrectly generates the `Affected Lints` section when a comma is included in the configuration documentation.

I made adjustments; however, if the `/// Lint: SOMETHING` section ends with `.` it always produces the correct output.
For example,
```rust
/// Lint: PUB_UNDERSCORE_FIELDS
```
should be
```rust
/// Lint: PUB_UNDERSCORE_FIELDS.
```

changelog: none
  • Loading branch information
bors committed Jan 4, 2024
2 parents 0bf0b88 + 9dcf926 commit 52ae262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ define_Conf! {
/// Lint: PUB_UNDERSCORE_FIELDS
///
/// Lint "public" fields in a struct that are prefixed with an underscore based on their
/// exported visibility; or whether they are marked as "pub".
/// exported visibility, or whether they are marked as "pub".
(pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PublicallyExported),
}

Expand Down
3 changes: 3 additions & 0 deletions clippy_config/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ fn parse_config_field_doc(doc_comment: &str) -> Option<(Vec<String>, String)> {
doc_comment.make_ascii_lowercase();
let lints: Vec<String> = doc_comment
.split_off(DOC_START.len())
.lines()
.next()
.unwrap()
.split(", ")
.map(str::to_string)
.collect();
Expand Down

0 comments on commit 52ae262

Please sign in to comment.