Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Combine related conditions

Marshall Bowers92f2e8eb34c0
diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs
index 008492f1784..d0613e13abc 100644
--- a/crates/workspace2/src/pane.rs
+++ b/crates/workspace2/src/pane.rs
@@ -1405,15 +1405,20 @@ impl Pane {
.items_center()
.justify_center()
// todo!("Nate - I need to do some work to balance all the items in the tab once things stablize")
- .when(close_right, |this| this.pl_3().pr_1())
- .when(!close_right, |this| this.pr_1().pr_3())
+ .map(|this| {
+ if close_right {
+ this.pl_3().pr_1()
+ } else {
+ this.pr_1().pr_3()
+ }
+ })
.py_1()
.bg(tab_bg)
.border_color(cx.theme().colors().border)
- .when(ix < self.active_item_index, |this| this.border_l())
- .when(ix > self.active_item_index, |this| this.border_r())
- .when(ix == self.active_item_index, |this| {
- this.border_l().border_r()
+ .map(|this| match ix.cmp(&self.active_item_index) {
+ cmp::Ordering::Less => this.border_l(),
+ cmp::Ordering::Equal => this.border_r(),
+ cmp::Ordering::Greater => this.border_l().border_r(),
})
// .hover(|h| h.bg(tab_hover_bg))
// .active(|a| a.bg(tab_active_bg))