Skip to content

Commit cc6a141

Browse files
committed
Fixes the irrefutable let pattern warning
1 parent 2089901 commit cc6a141

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

exercises/structs/structs1.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ struct ColorClassicStruct {
77

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

10-
struct ColorUnitStruct;
10+
#[derive(Debug)]
11+
struct UnitStruct;
1112

1213
#[cfg(test)]
1314
mod tests {
@@ -35,12 +36,9 @@ mod tests {
3536
#[test]
3637
fn unit_structs() {
3738
// TODO: Instantiate a unit struct!
38-
// let green =
39+
// let unit_struct =
40+
let message = format!("{:?}s are fun!", unit_struct);
3941

40-
if let ColorUnitStruct = green {
41-
assert!(true);
42-
} else {
43-
assert!(false);
44-
}
42+
assert_eq!(message, "UnitStructs are fun!");
4543
}
4644
}

0 commit comments

Comments
 (0)