Skip to content

Commit 11faa1e

Browse files
author
Yogthos
committed
chore: fix all compiler warnings (unused mut, unused vars, dead code)
1 parent 420aec2 commit 11faa1e

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

src/agent/agent_loop/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub async fn run_loop(
232232
// Multi-tier compaction tracking. Port of Reasonix
233233
// loop.ts:172 `this._foldedThisTurn`.
234234
// Reset each new user turn; set true when a fold happens.
235-
let mut folded_this_turn = false;
235+
let mut folded_this_turn: bool;
236236

237237
// Pi line 167: initial steering poll.
238238
let mut pending_messages: Vec<LoopMessage> = match &config.get_steering_messages {

src/ui/mod.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ fn write_user_lines(renderer: &mut Renderer, text: &str) -> std::io::Result<()>
180180
/// to read/write the UI-loop locals directly — only chat-switch
181181
/// boundaries pay for the swap.
182182
#[derive(Default)]
183+
#[allow(dead_code)]
183184
struct ChatUiState {
184185
response_buf: String,
185186
response_start_line: Option<usize>,
@@ -204,6 +205,7 @@ impl ChatUiState {
204205
/// supplied state slot. Called before switching chats so each chat's
205206
/// streaming context survives the swap.
206207
#[allow(clippy::too_many_arguments)]
208+
#[allow(dead_code)]
207209
fn save_chat_ui_state(
208210
slot: &mut ChatUiState,
209211
response_buf: &mut String,
@@ -234,6 +236,7 @@ fn save_chat_ui_state(
234236
/// dirge-ov2 Phase C: inverse of `save_chat_ui_state`. Loads the
235237
/// supplied state slot into the UI loop's locals after a chat switch.
236238
#[allow(clippy::too_many_arguments)]
239+
#[allow(dead_code)]
237240
fn load_chat_ui_state(
238241
slot: &mut ChatUiState,
239242
response_buf: &mut String,
@@ -615,6 +618,7 @@ fn sanitize_single_line(s: &str, max_chars: usize) -> String {
615618
/// it as a fresh chamber with the full body. We hold only the last
616619
/// one — older collapses live in chat history but aren't addressable.
617620
#[derive(Clone)]
621+
#[allow(dead_code)]
618622
pub(crate) struct CollapsedToolResult {
619623
pub tool_name: String,
620624
pub banner_value: String,
@@ -990,7 +994,7 @@ pub async fn run_interactive(
990994
// it as a fresh chamber with the full body. Only the most
991995
// recent collapse is retained — past collapses scroll away into
992996
// chat history and are not addressable.
993-
let mut last_collapsed: Option<CollapsedToolResult> = None;
997+
let mut _last_collapsed: Option<CollapsedToolResult> = None;
994998
#[allow(unused_mut)]
995999
let mut loop_label: Option<String> = None;
9961000
#[cfg(feature = "loop")]
@@ -1001,9 +1005,7 @@ pub async fn run_interactive(
10011005
rewind_picker.set_monochrome(cli.no_color);
10021006
let mut last_esc: Option<std::time::Instant> = None;
10031007
let mut search_active = false;
1004-
let mut search_query = String::new();
1005-
let mut search_matches: Vec<usize> = Vec::new();
1006-
let mut search_selected = 0usize;
1008+
10071009

10081010
// Snapshot plugin-registered shortcuts (P9c). Seeded at UI
10091011
// startup; refreshed at the top of each event loop iteration
@@ -1600,7 +1602,7 @@ pub async fn run_interactive(
16001602
// from a previous, unrelated turn. New
16011603
// truncations during the turn populate
16021604
// it again.
1603-
last_collapsed = None;
1605+
_last_collapsed = None;
16041606
#[cfg(feature = "loop")]
16051607
if loop_state.as_ref().is_some_and(|ls| ls.active) && !text.starts_with('/') {
16061608
// Queue the message instead of dropping it.
@@ -2531,7 +2533,7 @@ pub async fn run_interactive(
25312533
tool_chamber_open = false;
25322534
} else {
25332535
// No diff section found, show normally
2534-
last_collapsed = render_tool_output(
2536+
_last_collapsed = render_tool_output(
25352537
&mut renderer,
25362538
&resolved_name,
25372539
&banner_value,
@@ -2542,7 +2544,7 @@ pub async fn run_interactive(
25422544
tool_chamber_open = false;
25432545
}
25442546
} else {
2545-
last_collapsed = render_tool_output(
2547+
_last_collapsed = render_tool_output(
25462548
&mut renderer,
25472549
&resolved_name,
25482550
&banner_value,
@@ -3250,7 +3252,7 @@ pub async fn run_interactive(
32503252
// care about results from the new
32513253
// attempt, not what got truncated
32523254
// before the overflow.
3253-
last_collapsed = None;
3255+
_last_collapsed = None;
32543256
renderer.write_line(
32553257
" ↳ resumed run with compacted history",
32563258
theme::dim(),
@@ -5096,6 +5098,7 @@ fn render_tool_output(
50965098
/// Re-render a previously-collapsed result with NO line cap, as a
50975099
/// fresh chamber below the prior chat content. Char ceiling still
50985100
/// applies so a multi-MB output doesn't take forever.
5101+
#[allow(dead_code)]
50995102
fn render_collapsed_in_full(
51005103
renderer: &mut Renderer,
51015104
collapsed: &CollapsedToolResult,
@@ -5166,6 +5169,7 @@ fn chamber_row_with_bg(content: &str, inner: usize, bg_idx: u8) -> String {
51665169
/// lowercase query matches both cases; mixed-case query forces an
51675170
/// exact-case match — handled inside `Atom::new` with
51685171
/// `CaseMatching::Smart`.
5172+
#[allow(dead_code)]
51695173
fn update_search(renderer: &Renderer, query: &str, matches: &mut Vec<usize>, selected: &mut usize) {
51705174
use nucleo_matcher::pattern::{Atom, AtomKind, CaseMatching, Normalization};
51715175
use nucleo_matcher::{Config, Matcher, Utf32Str};
@@ -5206,6 +5210,7 @@ fn update_search(renderer: &Renderer, query: &str, matches: &mut Vec<usize>, sel
52065210
*matches = scored.into_iter().map(|(idx, _)| idx).collect();
52075211
}
52085212

5213+
#[allow(dead_code)]
52095214
fn draw_search_bar(query: &str, matches: &[usize], selected: usize) -> std::io::Result<()> {
52105215
use crossterm::style::{Attribute, ResetColor, SetAttribute, SetForegroundColor};
52115216
use crossterm::terminal::{Clear, ClearType};

src/ui/renderer.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ pub struct LeftPanelInfo {
144144
/// main session is always at index 0; subagent chats start at index
145145
/// 1. Selection state lives per-chat because a selection in chat A
146146
/// would be meaningless when chat B is on screen.
147+
#[allow(dead_code)]
147148
pub struct ChatSnapshot {
148149
pub name: String,
149150
buffer: Vec<LineEntry>,
@@ -433,6 +434,7 @@ impl Renderer {
433434
/// state to its snapshot, loads the target chat's snapshot into
434435
/// the Renderer's hot fields, and triggers a viewport repaint via
435436
/// the next render call. No-op if `idx == active_chat`.
437+
#[allow(dead_code)]
436438
pub fn switch_chat(&mut self, idx: usize) {
437439
if idx == self.active_chat || idx >= self.chats.len() {
438440
return;
@@ -461,6 +463,7 @@ impl Renderer {
461463
/// chat's slot. Called before switching chats and when the
462464
/// caller wants a consistent persistent state (e.g. session
463465
/// save).
466+
#[allow(dead_code)]
464467
fn save_active(&mut self) {
465468
let slot = &mut self.chats[self.active_chat];
466469
slot.buffer = std::mem::take(&mut self.buffer);
@@ -477,6 +480,7 @@ impl Renderer {
477480
/// dirge-ov2: load the active chat's snapshot into the hot
478481
/// fields. Inverse of `save_active`. Called after `switch_chat`
479482
/// updates `active_chat`.
483+
#[allow(dead_code)]
480484
fn load_active(&mut self) {
481485
let slot = &mut self.chats[self.active_chat];
482486
self.buffer = std::mem::take(&mut slot.buffer);
@@ -1286,7 +1290,7 @@ fn wrap_editor(full: &str, cursor_byte: usize, wrap_w: usize) -> (Vec<String>, u
12861290
let mut byte_idx: usize = 0;
12871291
for logical in full.split('\n') {
12881292
let logical_start = byte_idx;
1289-
let logical_end = logical_start + logical.len();
1293+
let _logical_end = logical_start + logical.len();
12901294

12911295
// Word-aware soft wrapping for this logical line.
12921296
let mut cur = String::new();
@@ -1380,6 +1384,7 @@ fn left_truncate(s: &str, max: usize) -> String {
13801384
out
13811385
}
13821386

1387+
#[allow(dead_code)]
13831388
pub fn copy_to_clipboard(text: &str) {
13841389
let cmds: &[(&str, &[&str])] = &[
13851390
("wl-copy", &[]),

src/ui/theme.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ pub fn banner_secondary() -> Color {
383383
/// covered the 16-color named palette — a user theme with
384384
/// `#ff00ff` (vibrant magenta) was treated as dim and lost its
385385
/// bold attribute.
386+
#[allow(dead_code)]
386387
pub fn is_bright(c: Color) -> bool {
387388
match c {
388389
Color::Green

0 commit comments

Comments
 (0)