From e842e01ac1e32c9f995f3a2690823a5cc74cfe4d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 18 Jun 2024 20:00:29 +0300 Subject: [PATCH] refactor: make variable have an initial value Clearer for me. Signed-off-by: Lars Wirzenius --- src/msg.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/msg.rs b/src/msg.rs index ed35db86..3bff0a05 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -153,24 +153,22 @@ impl<'a> RequestBuilder<'a> { } }; - let push_info: Option; - let patch_info: Option; + let mut push: Option = None; + let mut patch: Option = None; let event_type: EventType; if let Some(parsed_ref) = parse_ref(name) { match parsed_ref { ParsedRef::Patch(_oid) => { event_type = EventType::Patch; - patch_info = Some( + patch = Some( self.build_trigger_from_patch(event, repository, &repo, profile, author)?, ); - push_info = None; } ParsedRef::Push(_branch) => { event_type = EventType::Push; let before_oid: Oid = old.unwrap_or(*oid); - push_info = + push = Some(self.build_trigger_from_push(repo, author, name, before_oid, *oid)?); - patch_info = None; } } let common = EventCommonFields { @@ -181,8 +179,8 @@ impl<'a> RequestBuilder<'a> { Ok(Request::Trigger { common, - push: push_info, - patch: patch_info, + push, + patch, }) } else { Err(MessageError::NoEventHandler)