style(tui): apply rustfmt and clippy formatting across crate

Mechanical formatting pass to satisfy rustfmt line-width limits and
clippy pedantic/nursery lints. No behavioral changes.

Formatting (rustfmt line wrapping):
- action/sync.rs: multiline tuple destructure, function call args in tests
- state/sync.rs: if-let chain formatting, remove unnecessary Vec collect
- view/sync.rs: multiline array entries, format!(), vec! literals
- view/doctor.rs: multiline floor_char_boundary chain
- view/scope_picker.rs: multiline format!() with floor_char_boundary
- view/stats.rs: multiline render_stat_row call
- view/mod.rs: multiline assert!() in test
- app/update.rs: multiline enum variant destructure
- entity_cache.rs: multiline assert_eq!() with messages
- render_cache.rs: multiline retain() closure
- session.rs: multiline serde_json/File::create/parent() chains

Clippy:
- action/sync.rs: #[allow(clippy::too_many_arguments)] on test helper

Import/module ordering (alphabetical):
- state/mod.rs: move scope_picker mod + pub use to sorted position
- view/mod.rs: move scope_picker, stats, sync mod + use to sorted position
- view/scope_picker.rs: sort use imports (ScopeContext before ScopePickerState)
This commit is contained in:
teernisse
2026-02-18 23:58:13 -05:00
parent 09ffcfcf0f
commit 1b66b80ac4
12 changed files with 158 additions and 56 deletions

View File

@@ -22,13 +22,13 @@ pub mod issue_detail;
pub mod issue_list;
pub mod mr_detail;
pub mod mr_list;
pub mod scope_picker;
pub mod search;
pub mod stats;
pub mod sync;
pub mod sync_delta_ledger;
pub mod timeline;
pub mod trace;
pub mod scope_picker;
pub mod who;
use std::collections::{HashMap, HashSet};
@@ -45,12 +45,12 @@ pub use issue_detail::IssueDetailState;
pub use issue_list::IssueListState;
pub use mr_detail::MrDetailState;
pub use mr_list::MrListState;
pub use scope_picker::ScopePickerState;
pub use search::SearchState;
pub use stats::StatsState;
pub use sync::SyncState;
pub use timeline::TimelineState;
pub use trace::TraceState;
pub use scope_picker::ScopePickerState;
pub use who::WhoState;
// ---------------------------------------------------------------------------

View File

@@ -356,12 +356,12 @@ impl SyncState {
self.bytes_synced = bytes;
self.items_synced = items;
// Compute actual throughput from elapsed time since sync start.
if items > 0 {
if let Some(started) = self.started_at {
let elapsed_secs = started.elapsed().as_secs_f64();
if elapsed_secs > 0.0 {
self.items_per_sec = items as f64 / elapsed_secs;
}
if items > 0
&& let Some(started) = self.started_at
{
let elapsed_secs = started.elapsed().as_secs_f64();
if elapsed_secs > 0.0 {
self.items_per_sec = items as f64 / elapsed_secs;
}
}
}
@@ -375,8 +375,7 @@ impl SyncState {
/// Overall progress fraction (average of all lanes).
#[must_use]
pub fn overall_progress(&self) -> f64 {
let active_lanes: Vec<&LaneProgress> =
self.lanes.iter().filter(|l| l.total > 0).collect();
let active_lanes: Vec<&LaneProgress> = self.lanes.iter().filter(|l| l.total > 0).collect();
if active_lanes.is_empty() {
return 0.0;
}
@@ -537,10 +536,7 @@ mod tests {
}
}
// With ~0ms between calls, at most 0-1 additional emits expected.
assert!(
emitted <= 1,
"Expected at most 1 emit, got {emitted}"
);
assert!(emitted <= 1, "Expected at most 1 emit, got {emitted}");
}
#[test]