Skip to content

Commit

Permalink
Auto merge of rust-lang#179 - briankung:fix_irrefutable_let_pattern_s…
Browse files Browse the repository at this point in the history
…tructs1, r=komaeda

Fixes the irrefutable let pattern warning in `structs1.rs`

PR rust-lang#163 accidentally introduced an error using some versions of the Rust compiler where the compiler would (rightly!) complain about an irrefutable let pattern. I have no idea why this did not occur in all versions of the compiler, but here is a way around it.
  • Loading branch information
bors committed Jun 20, 2019
2 parents 28cf4d3 + fc561f5 commit 6eb1cf6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions exercises/structs/structs1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ struct ColorClassicStruct {

struct ColorTupleStruct(/* TODO: Something goes here */);

struct ColorUnitStruct;
#[derive(Debug)]
struct UnitStruct;

#[cfg(test)]
mod tests {
Expand Down Expand Up @@ -35,12 +36,9 @@ mod tests {
#[test]
fn unit_structs() {
// TODO: Instantiate a unit struct!
// let green =
// let unit_struct =
let message = format!("{:?}s are fun!", unit_struct);

if let ColorUnitStruct = green {
assert!(true);
} else {
assert!(false);
}
assert_eq!(message, "UnitStructs are fun!");
}
}

0 comments on commit 6eb1cf6

Please sign in to comment.