-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove bar
from blacklisted names
#5712
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthiaskrgr (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM, don't worry about the CI failure, this will be fixed with #5711
You have to update the stderr
file. You can do this with sh tests/ui/update-all-references.sh
after running cargo uitest
.
r? @flip1995 |
Or you can just apply this patch: diff --git a/tests/ui/blacklisted_name.rs b/tests/ui/blacklisted_name.rs
index 3d87eb061..093195efc 100644
--- a/tests/ui/blacklisted_name.rs
+++ b/tests/ui/blacklisted_name.rs
@@ -16,6 +16,7 @@ fn main() {
let quux = 42;
// Unlike these others, `bar` is considered an acceptable name to use.
// See https://github.com/rust-lang/rust-clippy/issues/5225.
+ let bar = 42;
let food = 42;
let foodstuffs = 42;
diff --git a/tests/ui/blacklisted_name.stderr b/tests/ui/blacklisted_name.stderr
index 44123829f..3ff5d2760 100644
--- a/tests/ui/blacklisted_name.stderr
+++ b/tests/ui/blacklisted_name.stderr
@@ -12,77 +12,77 @@ error: use of a blacklisted/placeholder name `foo`
LL | let foo = 42;
| ^^^
-error: use of a blacklisted/placeholder name `bar`
+error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:15:9
|
-LL | let bar = 42;
+LL | let baz = 42;
| ^^^
-error: use of a blacklisted/placeholder name `baz`
+error: use of a blacklisted/placeholder name `quux`
--> $DIR/blacklisted_name.rs:16:9
|
-LL | let baz = 42;
- | ^^^
+LL | let quux = 42;
+ | ^^^^
error: use of a blacklisted/placeholder name `foo`
- --> $DIR/blacklisted_name.rs:22:10
+ --> $DIR/blacklisted_name.rs:26:10
|
-LL | (foo, Some(bar), baz @ Some(_)) => (),
+LL | (foo, Some(baz), quux @ Some(_)) => (),
| ^^^
-error: use of a blacklisted/placeholder name `bar`
- --> $DIR/blacklisted_name.rs:22:20
+error: use of a blacklisted/placeholder name `baz`
+ --> $DIR/blacklisted_name.rs:26:20
|
-LL | (foo, Some(bar), baz @ Some(_)) => (),
+LL | (foo, Some(baz), quux @ Some(_)) => (),
| ^^^
-error: use of a blacklisted/placeholder name `baz`
- --> $DIR/blacklisted_name.rs:22:26
+error: use of a blacklisted/placeholder name `quux`
+ --> $DIR/blacklisted_name.rs:26:26
|
-LL | (foo, Some(bar), baz @ Some(_)) => (),
- | ^^^
+LL | (foo, Some(baz), quux @ Some(_)) => (),
+ | ^^^^
error: use of a blacklisted/placeholder name `foo`
- --> $DIR/blacklisted_name.rs:27:19
+ --> $DIR/blacklisted_name.rs:31:19
|
LL | fn issue_1647(mut foo: u8) {
| ^^^
-error: use of a blacklisted/placeholder name `bar`
- --> $DIR/blacklisted_name.rs:28:13
+error: use of a blacklisted/placeholder name `baz`
+ --> $DIR/blacklisted_name.rs:32:13
|
-LL | let mut bar = 0;
+LL | let mut baz = 0;
| ^^^
-error: use of a blacklisted/placeholder name `baz`
- --> $DIR/blacklisted_name.rs:29:21
+error: use of a blacklisted/placeholder name `quux`
+ --> $DIR/blacklisted_name.rs:33:21
|
-LL | if let Some(mut baz) = Some(42) {}
- | ^^^
+LL | if let Some(mut quux) = Some(42) {}
+ | ^^^^
-error: use of a blacklisted/placeholder name `bar`
- --> $DIR/blacklisted_name.rs:33:13
+error: use of a blacklisted/placeholder name `baz`
+ --> $DIR/blacklisted_name.rs:37:13
|
-LL | let ref bar = 0;
+LL | let ref baz = 0;
| ^^^
-error: use of a blacklisted/placeholder name `baz`
- --> $DIR/blacklisted_name.rs:34:21
+error: use of a blacklisted/placeholder name `quux`
+ --> $DIR/blacklisted_name.rs:38:21
|
-LL | if let Some(ref baz) = Some(42) {}
- | ^^^
+LL | if let Some(ref quux) = Some(42) {}
+ | ^^^^
-error: use of a blacklisted/placeholder name `bar`
- --> $DIR/blacklisted_name.rs:38:17
+error: use of a blacklisted/placeholder name `baz`
+ --> $DIR/blacklisted_name.rs:42:17
|
-LL | let ref mut bar = 0;
+LL | let ref mut baz = 0;
| ^^^
-error: use of a blacklisted/placeholder name `baz`
- --> $DIR/blacklisted_name.rs:39:25
+error: use of a blacklisted/placeholder name `quux`
+ --> $DIR/blacklisted_name.rs:43:25
|
-LL | if let Some(ref mut baz) = Some(42) {}
- | ^^^
+LL | if let Some(ref mut quux) = Some(42) {}
+ | ^^^^
error: aborting due to 14 previous errors |
@@ -107,7 +107,7 @@ macro_rules! define_Conf { | |||
pub use self::helpers::Conf; | |||
define_Conf! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would explain in the documentation why "bar" isn't in that list, as it's a well-known list and I wouldn't be surprised if someone raised the issue or opened a PR to readd it "because we forgot about it".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll try reinforcing the situation in the comments. Thanks!
@bors r+ rollup |
📌 Commit 454ed47 has been approved by |
🌲 The tree is currently closed for pull requests below priority 10, this pull request will be tested once the tree is reopened |
Rollup of 9 pull requests Successful merges: - #5178 (clippy-driver: pass all args to rustc if --rustc is present) - #5705 (Downgrade unnested_or_patterns to pedantic) - #5709 (Fix ICE in consts::binop) - #5710 (typo) - #5712 (Remove `bar` from blacklisted names) - #5713 (Use lints in Clippy that are enabled in rustc bootstrap) - #5716 (Fix typo in wildcard_imports) - #5724 (redundant_pattern_matching: avoid non-`const fn` calls in const contexts) - #5726 (Fix typo) Failed merges: r? @ghost changelog: rollup
changelog: Remove
bar
from blacklisted namesfixes #5225