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

Unused variable suggestions apply on all patterns. #57899

Merged
merged 1 commit into from Jan 28, 2019

Conversation

Projects
None yet
5 participants
@davidtwco
Copy link
Member

davidtwco commented Jan 25, 2019

Fixes #56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)

Show resolved Hide resolved src/test/ui/issues/issue-56685.rs
Show resolved Hide resolved src/librustc/middle/liveness.rs Outdated

@davidtwco davidtwco force-pushed the davidtwco:issue-56685 branch from 1eb1f25 to 12cdaec Jan 25, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 25, 2019

@bors r+

1 similar comment
@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 25, 2019

@bors r+

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 25, 2019

@bors are you still there?

@Centril Centril closed this Jan 25, 2019

@Centril Centril reopened this Jan 25, 2019

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 25, 2019

@bors r=estebank

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 25, 2019

📌 Commit 12cdaec has been approved by estebank

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 25, 2019

@estebank Bors just likes me more =P

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 26, 2019

Rollup fairness, @bors p=1

Centril added a commit to Centril/rust that referenced this pull request Jan 27, 2019

Rollup merge of rust-lang#57899 - davidtwco:issue-56685, r=estebank
Unused variable suggestions apply on all patterns.

Fixes rust-lang#56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)

bors added a commit that referenced this pull request Jan 27, 2019

Auto merge of #57930 - Centril:rollup, r=Centril
Rollup of 3 pull requests

Successful merges:

 - #57899 (Unused variable suggestions apply on all patterns.)
 - #57925 (Enable RISC-V atomic compare and swap)
 - #57927 (Remove lexical scope examples from std::mem::drop)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 27, 2019

⌛️ Testing commit 12cdaec with merge 22768cc...

bors added a commit that referenced this pull request Jan 27, 2019

Auto merge of #57899 - davidtwco:issue-56685, r=estebank
Unused variable suggestions apply on all patterns.

Fixes #56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 27, 2019

Failed in rollup, #57930 (comment)

@bors r- retry

@bors

This comment was marked as resolved.

Copy link
Contributor

bors commented Jan 27, 2019

☔️ The latest upstream changes (presumably #57907) made this pull request unmergeable. Please resolve the merge conflicts.

@davidtwco davidtwco force-pushed the davidtwco:issue-56685 branch from 12cdaec to cd6e1ce Jan 27, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 27, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 27, 2019

📌 Commit cd6e1ce has been approved by estebank

Centril added a commit to Centril/rust that referenced this pull request Jan 27, 2019

Rollup merge of rust-lang#57899 - davidtwco:issue-56685, r=estebank
Unused variable suggestions apply on all patterns.

Fixes rust-lang#56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)

bors added a commit that referenced this pull request Jan 27, 2019

Auto merge of #57938 - Centril:rollup, r=Centril
Rollup of 3 pull requests

Successful merges:

 - #57442 (Simplify `ConstValue::ScalarPair`)
 - #57691 (Conditionally skip two passes if their related attributes were not found)
 - #57899 (Unused variable suggestions apply on all patterns.)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2019

⌛️ Testing commit cd6e1ce with merge b9a301e...

bors added a commit that referenced this pull request Jan 28, 2019

Auto merge of #57899 - davidtwco:issue-56685, r=estebank
Unused variable suggestions apply on all patterns.

Fixes #56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 28, 2019

Failed in rollup, #57938 (comment).

@bors r- retry

@estebank

This comment was marked as resolved.

Copy link
Contributor

estebank commented Jan 28, 2019


failures:
---- [ui] ui\lint\issue-47390-unused-variable-in-struct-pattern.rs stdout ----
diff of stderr:
29	LL |     let (mut var, unused_var) = (1, 2);
30	   |                   ^^^^^^^^^^ help: consider prefixing with an underscore: `_unused_var`
31	
-	warning: unused variable: `corridors_of_light`
-	  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:26
-	   |
-	LL |     if let SoulHistory { corridors_of_light,
-	   |                          ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _`
-	
38	warning: variable `hours_are_suns` is assigned to, but never used
39	  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:38:30
40	   |
42	   |                              ^^^^^^^^^^^^^^
43	   |
44	   = note: consider using `_hours_are_suns` instead
+	
+	warning: unused variable: `corridors_of_light`
+	  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:26
+	   |
+	LL |     if let SoulHistory { corridors_of_light,
+	   |                          ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _`
45	
46	warning: value assigned to `hours_are_suns` is never read
47	  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:40:9
The actual stderr differed from the expected stderr.
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 28, 2019

@estebank --bless your heart ;)

Unused variable suggestions on all patterns.
This commit extends existing suggestions to prefix unused variable
bindings in match arms with an underscore so that it applies to all
patterns in a match arm.

@davidtwco davidtwco force-pushed the davidtwco:issue-56685 branch from cd6e1ce to 5f021e0 Jan 28, 2019

@davidtwco

This comment has been minimized.

Copy link
Member Author

davidtwco commented Jan 28, 2019

@bors r=estebank

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2019

📌 Commit 5f021e0 has been approved by estebank

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2019

⌛️ Testing commit 5f021e0 with merge a21bd75...

bors added a commit that referenced this pull request Jan 28, 2019

Auto merge of #57899 - davidtwco:issue-56685, r=estebank
Unused variable suggestions apply on all patterns.

Fixes #56685.

This PR extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.

r? @estebank
cc @alexcrichton (since you filed the issue)
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: estebank
Pushing a21bd75 to master...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: estebank
Pushing a21bd75 to master...

@bors bors merged commit 5f021e0 into rust-lang:master Jan 28, 2019

1 check passed

homu Test successful
Details

@davidtwco davidtwco deleted the davidtwco:issue-56685 branch Jan 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment