-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing panic paths by only destructuring once (#1523)
We have a few functions of the form ```rust match message { Message::RepairAckId { .. } => self.on_repair_ack(message), // ... } // ...later in the file: fn on_repair_ack(&self, message: &Message) { let Message::RepairAckId { repair_id } = message else { panic!() }; // ... } ``` This PR refactors those functions to only destructure the message once, passing its inner fields into the function which needs them. It makes the code shorter _and_ removes possible panic paths.
- Loading branch information
Showing
2 changed files
with
33 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters