Skip to content

Commit

Permalink
Fixes the irrefutable let pattern warning
Browse files Browse the repository at this point in the history
  • Loading branch information
briankung committed Jun 20, 2019
1 parent 2089901 commit cc6a141
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 cc6a141

Please sign in to comment.