git_ui: Combine disjoint conditions into one (#25722)
This PR combines two disjoint conditions for the same value into one. This makes it so the type checker can accurately reason about the branches. Release Notes: - N/A
This commit is contained in:
parent
81badd1fe6
commit
3505a17452
1 changed files with 5 additions and 7 deletions
|
@ -141,18 +141,16 @@ impl Render for BranchList {
|
||||||
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
v_flex()
|
v_flex()
|
||||||
.w(rems(self.rem_width))
|
.w(rems(self.rem_width))
|
||||||
.when_some(self.picker.clone(), |div, picker| {
|
.map(|parent| match self.picker.as_ref() {
|
||||||
div.child(picker.clone()).on_mouse_down_out({
|
Some(picker) => parent.child(picker.clone()).on_mouse_down_out({
|
||||||
let picker = picker.clone();
|
let picker = picker.clone();
|
||||||
cx.listener(move |_, _, window, cx| {
|
cx.listener(move |_, _, window, cx| {
|
||||||
picker.update(cx, |this, cx| {
|
picker.update(cx, |this, cx| {
|
||||||
this.cancel(&Default::default(), window, cx);
|
this.cancel(&Default::default(), window, cx);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}),
|
||||||
})
|
None => parent.child(
|
||||||
.when_none(&self.picker, |div| {
|
|
||||||
div.child(
|
|
||||||
h_flex()
|
h_flex()
|
||||||
.id("branch-picker-error")
|
.id("branch-picker-error")
|
||||||
.on_click(
|
.on_click(
|
||||||
|
@ -160,7 +158,7 @@ impl Render for BranchList {
|
||||||
)
|
)
|
||||||
.child("Could not load branches.")
|
.child("Could not load branches.")
|
||||||
.child("Click to retry"),
|
.child("Click to retry"),
|
||||||
)
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue