-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #8944 - xFrednet:8877-append-doc-idents, r=Manishearth
List configuration values can now be extended instead of replaced I've seen some `clippy.toml` files, that have a few additions to the default list of a configuration and then a copy of our default. The list will therefore not be updated, when we add new names. This change should make it simple for new users to append values instead of replacing them. I'm uncertain if the documentation of the `".."` is apparent. Any suggestions are welcome. I've also check that the lint list displays the examples correctly. <details> <summary>Lint list screenshots</summary> ![image](https://user-images.githubusercontent.com/17087237/171999434-393f2f83-09aa-4bab-8b05-bd4973150f27.png) ![image](https://user-images.githubusercontent.com/17087237/171999401-e6942b53-25e6-4b09-89e5-d867c7463156.png) </details> --- changelog: enhancement: [`doc_markdown`]: Users can now indicate, that the `doc-valid-idents` should extend the default and not replace it changelog: enhancement: [`blacklisted-name`]: Users can now indicate, that the `blacklisted-names` should extend the default and not replace it Closes: #8877 That's it. Have a fantastic weekend to everyone reading this. Here is a cookie 🍪
- Loading branch information
Showing
13 changed files
with
174 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/ui-toml/blacklisted_names_append/blacklisted_names.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[warn(clippy::blacklisted_name)] | ||
|
||
fn main() { | ||
// `foo` is part of the default configuration | ||
let foo = "bar"; | ||
// `ducks` was unrightfully blacklisted | ||
let ducks = ["quack", "quack"]; | ||
// `fox` is okay | ||
let fox = ["what", "does", "the", "fox", "say", "?"]; | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/ui-toml/blacklisted_names_append/blacklisted_names.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: use of a blacklisted/placeholder name `foo` | ||
--> $DIR/blacklisted_names.rs:5:9 | ||
| | ||
LL | let foo = "bar"; | ||
| ^^^ | ||
| | ||
= note: `-D clippy::blacklisted-name` implied by `-D warnings` | ||
|
||
error: use of a blacklisted/placeholder name `ducks` | ||
--> $DIR/blacklisted_names.rs:7:9 | ||
| | ||
LL | let ducks = ["quack", "quack"]; | ||
| ^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blacklisted-names = ["ducks", ".."] |
10 changes: 10 additions & 0 deletions
10
tests/ui-toml/blacklisted_names_replace/blacklisted_names.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[warn(clippy::blacklisted_name)] | ||
|
||
fn main() { | ||
// `foo` is part of the default configuration | ||
let foo = "bar"; | ||
// `ducks` was unrightfully blacklisted | ||
let ducks = ["quack", "quack"]; | ||
// `fox` is okay | ||
let fox = ["what", "does", "the", "fox", "say", "?"]; | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/ui-toml/blacklisted_names_replace/blacklisted_names.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: use of a blacklisted/placeholder name `ducks` | ||
--> $DIR/blacklisted_names.rs:7:9 | ||
| | ||
LL | let ducks = ["quack", "quack"]; | ||
| ^^^^^ | ||
| | ||
= note: `-D clippy::blacklisted-name` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blacklisted-names = ["ducks"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
doc-valid-idents = ["ClipPy", ".."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![warn(clippy::doc_markdown)] | ||
|
||
/// This is a special interface for ClipPy which doesn't require backticks | ||
fn allowed_name() {} | ||
|
||
/// OAuth and LaTeX are inside Clippy's default list. | ||
fn default_name() {} | ||
|
||
/// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted. | ||
fn unknown_name() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: item in documentation is missing backticks | ||
--> $DIR/doc_markdown.rs:9:5 | ||
| | ||
LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted. | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::doc-markdown` implied by `-D warnings` | ||
help: try | ||
| | ||
LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
doc-valid-idents = ["ClipPy"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![warn(clippy::doc_markdown)] | ||
|
||
/// This is a special interface for ClipPy which doesn't require backticks | ||
fn allowed_name() {} | ||
|
||
/// OAuth and LaTeX are inside Clippy's default list. | ||
fn default_name() {} | ||
|
||
/// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted. | ||
fn unknown_name() {} | ||
|
||
fn main() {} |
36 changes: 36 additions & 0 deletions
36
tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error: item in documentation is missing backticks | ||
--> $DIR/doc_markdown.rs:6:5 | ||
| | ||
LL | /// OAuth and LaTeX are inside Clippy's default list. | ||
| ^^^^^ | ||
| | ||
= note: `-D clippy::doc-markdown` implied by `-D warnings` | ||
help: try | ||
| | ||
LL | /// `OAuth` and LaTeX are inside Clippy's default list. | ||
| ~~~~~~~ | ||
|
||
error: item in documentation is missing backticks | ||
--> $DIR/doc_markdown.rs:6:15 | ||
| | ||
LL | /// OAuth and LaTeX are inside Clippy's default list. | ||
| ^^^^^ | ||
| | ||
help: try | ||
| | ||
LL | /// OAuth and `LaTeX` are inside Clippy's default list. | ||
| ~~~~~~~ | ||
|
||
error: item in documentation is missing backticks | ||
--> $DIR/doc_markdown.rs:9:5 | ||
| | ||
LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted. | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: try | ||
| | ||
LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: aborting due to 3 previous errors | ||
|