mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-21 02:40:42 +08:00
refactor: make variable have an initial value
Clearer for me. Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+6
-8
@@ -153,24 +153,22 @@ impl<'a> RequestBuilder<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
let push_info: Option<PushEvent>;
|
||||
let patch_info: Option<PatchEvent>;
|
||||
let mut push: Option<PushEvent> = None;
|
||||
let mut patch: Option<PatchEvent> = 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)
|
||||
|
||||
Reference in New Issue
Block a user