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

@@ -127,7 +127,9 @@ pub fn render_doctor(frame: &mut Frame<'_>, state: &DoctorState, area: Rect) {
let detail = if check.detail.len() > max_detail {
format!(
"{}...",
&check.detail[..check.detail.floor_char_boundary(max_detail.saturating_sub(3))]
&check.detail[..check
.detail
.floor_char_boundary(max_detail.saturating_sub(3))]
)
} else {
check.detail.clone()

View File

@@ -16,12 +16,12 @@ pub mod issue_detail;
pub mod issue_list;
pub mod mr_detail;
pub mod mr_list;
pub mod search;
pub mod timeline;
pub mod trace;
pub mod scope_picker;
pub mod search;
pub mod stats;
pub mod sync;
pub mod timeline;
pub mod trace;
pub mod who;
use ftui::layout::{Constraint, Flex};
@@ -43,12 +43,12 @@ use issue_detail::render_issue_detail;
use issue_list::render_issue_list;
use mr_detail::render_mr_detail;
use mr_list::render_mr_list;
use search::render_search;
use timeline::render_timeline;
use trace::render_trace;
use scope_picker::render_scope_picker;
use search::render_search;
use stats::render_stats;
use sync::render_sync;
use timeline::render_timeline;
use trace::render_trace;
use who::render_who;
// ---------------------------------------------------------------------------
@@ -261,10 +261,7 @@ mod tests {
let has_content = (20..60u16).any(|x| {
(8..16u16).any(|y| frame.buffer.get(x, y).is_some_and(|cell| !cell.is_empty()))
});
assert!(
has_content,
"Expected sync idle content in center area"
);
assert!(has_content, "Expected sync idle content in center area");
});
}
}

View File

@@ -8,8 +8,8 @@ use ftui::render::cell::{Cell, PackedRgba};
use ftui::render::drawing::{BorderChars, Draw};
use ftui::render::frame::Frame;
use crate::state::scope_picker::ScopePickerState;
use crate::state::ScopeContext;
use crate::state::scope_picker::ScopePickerState;
use super::{ACCENT, BG_SURFACE, BORDER, TEXT, TEXT_MUTED};
@@ -131,7 +131,10 @@ pub fn render_scope_picker(
// Truncate label to fit.
let max_label_len = content_width.saturating_sub(2) as usize; // 2 for prefix
let display = if label.len() > max_label_len {
format!("{prefix}{}...", &label[..label.floor_char_boundary(max_label_len.saturating_sub(3))])
format!(
"{prefix}{}...",
&label[..label.floor_char_boundary(max_label_len.saturating_sub(3))]
)
} else {
format!("{prefix}{label}")
};

View File

@@ -93,7 +93,15 @@ pub fn render_stats(frame: &mut Frame<'_>, state: &StatsState, area: Rect) {
if y >= area.bottom().saturating_sub(2) {
break;
}
render_stat_row(frame, area.x + 2, y, label, &format_count(*count), label_width, max_x);
render_stat_row(
frame,
area.x + 2,
y,
label,
&format_count(*count),
label_width,
max_x,
);
y += 1;
}

View File

@@ -262,8 +262,16 @@ fn render_summary(frame: &mut Frame<'_>, state: &SyncState, area: Rect) {
// Summary rows.
let rows = [
("Issues", summary.issues.new, summary.issues.updated),
("MRs", summary.merge_requests.new, summary.merge_requests.updated),
("Discussions", summary.discussions.new, summary.discussions.updated),
(
"MRs",
summary.merge_requests.new,
summary.merge_requests.updated,
),
(
"Discussions",
summary.discussions.new,
summary.discussions.updated,
),
("Notes", summary.notes.new, summary.notes.updated),
];
@@ -404,7 +412,10 @@ fn render_failed(frame: &mut Frame<'_>, area: Rect, error: &str) {
// Truncate error to fit screen.
let max_len = area.width.saturating_sub(4) as usize;
let display_err = if error.len() > max_len {
format!("{}...", &error[..error.floor_char_boundary(max_len.saturating_sub(3))])
format!(
"{}...",
&error[..error.floor_char_boundary(max_len.saturating_sub(3))]
)
} else {
error.to_string()
};
@@ -541,9 +552,7 @@ mod tests {
state.complete(3000);
state.summary = Some(SyncSummary {
elapsed_ms: 3000,
project_errors: vec![
("grp/repo".into(), "timeout".into()),
],
project_errors: vec![("grp/repo".into(), "timeout".into())],
..Default::default()
});
let area = frame.bounds();