Skip to content

Commit e7d60c0

Browse files
author
Constantin
authored
book: match enum warning removed
Matching enums with named fields in the previous way yielded the "non_shorthand_field_patterns" warning. The new code shows the shorthand syntax as well as field renaming, so it should be exhaustive ;-)
1 parent 1659d65 commit e7d60c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/book/match.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn process_message(msg: Message) {
8282
match msg {
8383
Message::Quit => quit(),
8484
Message::ChangeColor(r, g, b) => change_color(r, g, b),
85-
Message::Move { x: x, y: y } => move_cursor(x, y),
85+
Message::Move { x, y: new_name_for_y } => move_cursor(x, new_name_for_y),
8686
Message::Write(s) => println!("{}", s),
8787
};
8888
}

0 commit comments

Comments
 (0)