|
25 | 25 | //! Tests should construct a fresh `ChangeTrackerRegistry::new()` to |
26 | 26 | //! avoid contaminating each other through the thread-local global. |
27 | 27 |
|
28 | | -// Many items are public for the upcoming UI integration but unused |
29 | | -// at this point of the rollout — silence dead-code warnings module- |
30 | | -// wide rather than annotating each item. |
31 | | -#![allow(dead_code)] |
32 | | - |
33 | 28 | use std::cell::RefCell; |
34 | 29 | use std::collections::{HashMap, VecDeque}; |
35 | 30 |
|
@@ -204,6 +199,7 @@ pub struct TabChangeTracker { |
204 | 199 | } |
205 | 200 |
|
206 | 201 | impl TabChangeTracker { |
| 202 | + #[cfg(test)] |
207 | 203 | pub fn new() -> Self { |
208 | 204 | Self::default() |
209 | 205 | } |
@@ -416,10 +412,12 @@ impl TabChangeTracker { |
416 | 412 | Some(op) |
417 | 413 | } |
418 | 414 |
|
| 415 | + #[cfg(test)] |
419 | 416 | pub fn can_undo(&self) -> bool { |
420 | 417 | !self.undo.is_empty() |
421 | 418 | } |
422 | 419 |
|
| 420 | + #[cfg(test)] |
423 | 421 | pub fn can_redo(&self) -> bool { |
424 | 422 | !self.redo.is_empty() |
425 | 423 | } |
@@ -753,26 +751,22 @@ where |
753 | 751 | } |
754 | 752 |
|
755 | 753 | /// Open a tracker for a tab. Idempotent. |
756 | | -#[allow(dead_code)] |
757 | 754 | pub fn open_tab(tab_id: Uuid) { |
758 | 755 | REGISTRY.with(|reg| reg.borrow_mut().open_tab(tab_id)); |
759 | 756 | } |
760 | 757 |
|
761 | 758 | /// Drop a tab's tracker. Called when the BrowseTab is closed. |
762 | | -#[allow(dead_code)] |
763 | 759 | pub fn close_tab(tab_id: Uuid) { |
764 | 760 | REGISTRY.with(|reg| reg.borrow_mut().close_tab(tab_id)); |
765 | 761 | } |
766 | 762 |
|
767 | 763 | /// True if any open tab has pending changes — used by the app-level |
768 | 764 | /// quit guard to decide whether to show the "Unsaved changes" dialog. |
769 | | -#[allow(dead_code)] |
770 | 765 | pub fn any_pending_globally() -> bool { |
771 | 766 | REGISTRY.with(|reg| reg.borrow().any_pending()) |
772 | 767 | } |
773 | 768 |
|
774 | 769 | /// Tabs with pending changes — ordered arbitrary (HashMap iteration). |
775 | | -#[allow(dead_code)] |
776 | 770 | pub fn pending_tabs() -> Vec<Uuid> { |
777 | 771 | REGISTRY.with(|reg| reg.borrow().pending_tabs()) |
778 | 772 | } |
|
0 commit comments