-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest swapping the order of
ref
and box
- Loading branch information
1 parent
b29a1e0
commit f4c2bde
Showing
6 changed files
with
55 additions
and
2 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
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
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
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 @@ | ||
// run-rustfix | ||
|
||
#![feature(box_patterns)] | ||
#![allow(dead_code)] | ||
|
||
fn foo(f: Option<Box<i32>>) { | ||
match f { | ||
Some(box ref _i) => {}, | ||
//~^ ERROR switch the order of `ref` and `box` | ||
None => {} | ||
} | ||
} | ||
|
||
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 @@ | ||
// run-rustfix | ||
|
||
#![feature(box_patterns)] | ||
#![allow(dead_code)] | ||
|
||
fn foo(f: Option<Box<i32>>) { | ||
match f { | ||
Some(ref box _i) => {}, | ||
//~^ ERROR switch the order of `ref` and `box` | ||
None => {} | ||
} | ||
} | ||
|
||
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,8 @@ | ||
error: switch the order of `ref` and `box` | ||
--> $DIR/pattern-bad-ref-box-order.rs:8:14 | ||
| | ||
LL | Some(ref box _i) => {}, | ||
| ^^^^^^^ help: swap them: `box ref` | ||
|
||
error: aborting due to 1 previous error | ||
|