Open farodin91 opened 7 years ago
That's true but it's easy code; most of the lines are declarations of event structs. The biggest part of the function is the pattern matching on initial state which cannot be split (maybe a new function?). The only improvement I see is to remove the flags is_something_set
and just generate the events in the order specified by the spec. That will generate a few extra events that will be overwritten; that's why the flags exist.
I think of the following if creation_options.initial_state.is_some() {
.
Moving part in into private function would help reduce doubling, but make it much easier to read since every function has a name and a small doc.
Room::create is more than 350 lines of code. This helps make it easier to fix bugs in the function.