mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Remove unused Rust helpers (#17146)
## Summary Removes high-confidence unused Rust helper functions and exports across `codex-tui`, `codex-shell-command`, and utility crates. The cleanup includes dead TUI helper methods, unused path/string/elapsed/fuzzy-match utilities, an unused Windows PowerShell lookup helper, and the unused terminal palette version counter. This keeps the remaining public surface smaller without changing behavior. ## Validation - `just fmt` - `cargo test -p codex-tui -p codex-shell-command -p codex-utils-elapsed -p codex-utils-fuzzy-match -p codex-utils-string -p codex-utils-path` - `just fix -p codex-tui -p codex-shell-command -p codex-utils-elapsed -p codex-utils-fuzzy-match -p codex-utils-string -p codex-utils-path` - `git diff --check`
This commit is contained in:
@@ -126,11 +126,6 @@ impl AppCommand {
|
||||
Self(Op::RealtimeConversationAudio(params))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn realtime_conversation_text(params: ConversationTextParams) -> Self {
|
||||
Self(Op::RealtimeConversationText(params))
|
||||
}
|
||||
|
||||
pub(crate) fn realtime_conversation_close() -> Self {
|
||||
Self(Op::RealtimeConversationClose)
|
||||
}
|
||||
@@ -265,16 +260,6 @@ impl AppCommand {
|
||||
Self(Op::Review { review_request })
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn kind(&self) -> &'static str {
|
||||
self.0.kind()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn as_core(&self) -> &Op {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub(crate) fn into_core(self) -> Op {
|
||||
self.0
|
||||
}
|
||||
|
||||
@@ -777,16 +777,6 @@ pub(crate) fn status_account_display_from_auth_mode(
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn feedback_audience_from_account_email(
|
||||
account_email: Option<&str>,
|
||||
) -> FeedbackAudience {
|
||||
match account_email {
|
||||
Some(email) if email.ends_with("@openai.com") => FeedbackAudience::OpenAiEmployee,
|
||||
Some(_) | None => FeedbackAudience::External,
|
||||
}
|
||||
}
|
||||
|
||||
fn model_preset_from_api_model(model: ApiModel) -> ModelPreset {
|
||||
let upgrade = model.upgrade.map(|upgrade_id| {
|
||||
let upgrade_info = model.upgrade_info.clone();
|
||||
|
||||
@@ -90,11 +90,6 @@ impl AsciiAnimation {
|
||||
true
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn request_frame(&self) {
|
||||
self.request_frame.schedule_frame();
|
||||
}
|
||||
|
||||
fn frames(&self) -> &'static [&'static str] {
|
||||
self.variants[self.variant_idx]
|
||||
}
|
||||
|
||||
@@ -4735,14 +4735,6 @@ impl ChatWidget {
|
||||
Self::new_with_op_target(common, CodexOpTarget::AppEvent)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn new_with_op_sender(
|
||||
common: ChatWidgetInit,
|
||||
codex_op_tx: UnboundedSender<Op>,
|
||||
) -> Self {
|
||||
Self::new_with_op_target(common, CodexOpTarget::Direct(codex_op_tx))
|
||||
}
|
||||
|
||||
fn new_with_op_target(common: ChatWidgetInit, codex_op_target: CodexOpTarget) -> Self {
|
||||
let ChatWidgetInit {
|
||||
config,
|
||||
|
||||
@@ -81,11 +81,6 @@ impl RowBuilder {
|
||||
self.flush_current_line(/*explicit_break*/ true);
|
||||
}
|
||||
|
||||
/// Drain and return all produced rows.
|
||||
pub fn drain_rows(&mut self) -> Vec<Row> {
|
||||
std::mem::take(&mut self.rows)
|
||||
}
|
||||
|
||||
/// Return a snapshot of produced rows (non-draining).
|
||||
pub fn rows(&self) -> &[Row] {
|
||||
&self.rows
|
||||
|
||||
@@ -200,15 +200,6 @@ impl<'a> ColumnRenderable<'a> {
|
||||
pub fn push(&mut self, child: impl Into<Box<dyn Renderable + 'a>>) {
|
||||
self.children.push(RenderableItem::Owned(child.into()));
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn push_ref<R>(&mut self, child: &'a R)
|
||||
where
|
||||
R: Renderable + 'a,
|
||||
{
|
||||
self.children
|
||||
.push(RenderableItem::Borrowed(child as &'a dyn Renderable));
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FlexChild<'a> {
|
||||
@@ -374,15 +365,6 @@ impl<'a> RowRenderable<'a> {
|
||||
self.children
|
||||
.push((width, RenderableItem::Owned(child.into())));
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn push_ref<R>(&mut self, width: u16, child: &'a R)
|
||||
where
|
||||
R: Renderable + 'a,
|
||||
{
|
||||
self.children
|
||||
.push((width, RenderableItem::Borrowed(child as &'a dyn Renderable)));
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InsetRenderable<'a> {
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
use crate::color::perceptual_distance;
|
||||
use ratatui::style::Color;
|
||||
use std::sync::atomic::AtomicU64;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
static DEFAULT_PALETTE_VERSION: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
fn bump_palette_version() {
|
||||
DEFAULT_PALETTE_VERSION.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum StdoutColorLevel {
|
||||
@@ -56,7 +48,6 @@ pub fn best_color(target: (u8, u8, u8)) -> Color {
|
||||
|
||||
pub fn requery_default_colors() {
|
||||
imp::requery_default_colors();
|
||||
bump_palette_version();
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -77,14 +68,6 @@ pub fn default_bg() -> Option<(u8, u8, u8)> {
|
||||
default_colors().map(|c| c.bg)
|
||||
}
|
||||
|
||||
/// Returns a monotonic counter that increments whenever `requery_default_colors()` runs
|
||||
/// successfully so cached renderers can know when their styling assumptions (e.g.
|
||||
/// background colors baked into cached transcript rows) are stale and need invalidation.
|
||||
#[allow(dead_code)]
|
||||
pub fn palette_version() -> u64 {
|
||||
DEFAULT_PALETTE_VERSION.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(test)))]
|
||||
mod imp {
|
||||
use super::DefaultColors;
|
||||
|
||||
Reference in New Issue
Block a user