diff options
| author | bors <bors@rust-lang.org> | 2019-06-20 15:02:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-20 15:02:20 +0000 |
| commit | 752bc27e2bf166743be95508fefa9a15b247570b (patch) | |
| tree | 911db0509dcbfa5e818938b5f27d5864dbbe0253 /exercises/structs | |
| parent | b8d59d699bed76b6be95d1ed41881d00d4b0d533 (diff) | |
| parent | cc6a14104d7c034eadc98297eaaa972d09c50b1f (diff) | |
Auto merge of #179 - briankung:fix_irrefutable_let_pattern_structs1, r=komaeda
Fixes the irrefutable let pattern warning in `structs1.rs`
PR https://github.com/rust-lang/rustlings/pull/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.
Diffstat (limited to 'exercises/structs')
| -rw-r--r-- | exercises/structs/structs1.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/exercises/structs/structs1.rs b/exercises/structs/structs1.rs index e6c378f..870236d 100644 --- a/exercises/structs/structs1.rs +++ b/exercises/structs/structs1.rs @@ -7,7 +7,8 @@ struct ColorClassicStruct { struct ColorTupleStruct(/* TODO: Something goes here */); -struct ColorUnitStruct; +#[derive(Debug)] +struct UnitStruct; #[cfg(test)] mod tests { @@ -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!"); } } |
