Reuse `is_tab_pinned` method (#35551)

Joseph T. Lyons created

Release Notes:

- N/A

Change summary

crates/workspace/src/pane.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

crates/workspace/src/pane.rs 🔗

@@ -2832,7 +2832,7 @@ impl Pane {
             })
             .collect::<Vec<_>>();
         let tab_count = tab_items.len();
-        if self.pinned_tab_count > tab_count {
+        if self.is_tab_pinned(tab_count) {
             log::warn!(
                 "Pinned tab count ({}) exceeds actual tab count ({}). \
                 This should not happen. If possible, add reproduction steps, \
@@ -3062,13 +3062,13 @@ impl Pane {
                     }
                     to_pane.update(cx, |this, _| {
                         if to_pane == from_pane {
-                            let to_ix = this
+                            let actual_ix = this
                                 .items
                                 .iter()
                                 .position(|item| item.item_id() == item_id)
                                 .unwrap_or(0);
 
-                            let is_pinned_in_to_pane = to_ix < this.pinned_tab_count;
+                            let is_pinned_in_to_pane = this.is_tab_pinned(actual_ix);
 
                             if !was_pinned_in_from_pane && is_pinned_in_to_pane {
                                 this.pinned_tab_count += 1;