Merge pull request #1310 from HerschelW/enums3_chore

chore: update enums3.rs addressing extra parentheses usage with tuples
This commit is contained in:
liv 2022-12-30 16:52:29 +01:00 committed by GitHub
commit 69e8a35fd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,6 +38,7 @@ impl State {
fn process(&mut self, message: Message) { fn process(&mut self, message: Message) {
// TODO: create a match expression to process the different message variants // TODO: create a match expression to process the different message variants
// Remember: When passing a tuple as a function argument, you'll need extra parentheses: fn function((t, u, p, l, e))
} }
} }
@ -52,7 +53,7 @@ mod tests {
position: Point { x: 0, y: 0 }, position: Point { x: 0, y: 0 },
color: (0, 0, 0), color: (0, 0, 0),
}; };
state.process(Message::ChangeColor((255, 0, 255))); // Remember: The extra parentheses mark a tuple type. state.process(Message::ChangeColor(255, 0, 255));
state.process(Message::Echo(String::from("hello world"))); state.process(Message::Echo(String::from("hello world")));
state.process(Message::Move(Point { x: 10, y: 15 })); state.process(Message::Move(Point { x: 10, y: 15 }));
state.process(Message::Quit); state.process(Message::Quit);