diff --git a/codex-rs/core/src/auth.rs b/codex-rs/core/src/auth.rs index 1256584ce7..804512e20e 100644 --- a/codex-rs/core/src/auth.rs +++ b/codex-rs/core/src/auth.rs @@ -136,7 +136,7 @@ impl CodexAuth { pub fn get_account_id(&self) -> Option { self.get_current_token_data() - .and_then(|t| t.account_id.clone()) + .and_then(|t| t.account_id) } pub fn get_plan_type(&self) -> Option { @@ -150,7 +150,7 @@ impl CodexAuth { } fn get_current_token_data(&self) -> Option { - self.get_current_auth_json().and_then(|t| t.tokens.clone()) + self.get_current_auth_json().and_then(|t| t.tokens) } /// Consider this private to integration tests. @@ -332,10 +332,10 @@ async fn update_tokens( let tokens = auth_dot_json.tokens.get_or_insert_with(TokenData::default); tokens.id_token = parse_id_token(&id_token).map_err(std::io::Error::other)?; if let Some(access_token) = access_token { - tokens.access_token = access_token.to_string(); + tokens.access_token = access_token; } if let Some(refresh_token) = refresh_token { - tokens.refresh_token = refresh_token.to_string(); + tokens.refresh_token = refresh_token; } auth_dot_json.last_refresh = Some(Utc::now()); write_auth_json(auth_file, &auth_dot_json)?; diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 53730f5972..1f098b327b 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -208,7 +208,7 @@ impl Codex { // This task will run until Op::Shutdown is received. tokio::spawn(submission_loop( - session.clone(), + session, turn_context, config, rx_sub, @@ -1064,7 +1064,7 @@ impl AgentTask { id: self.sub_id, msg: EventMsg::TurnAborted(TurnAbortedEvent { reason }), }; - let sess = self.sess.clone(); + let sess = self.sess; tokio::spawn(async move { sess.send_event(event).await; }); @@ -1727,7 +1727,7 @@ async fn try_run_turn( } }) .map(|call_id| ResponseItem::CustomToolCallOutput { - call_id: call_id.clone(), + call_id: call_id, output: "aborted".to_string(), }) .collect::>() diff --git a/codex-rs/core/src/parse_command.rs b/codex-rs/core/src/parse_command.rs index 15dd2ff411..a0673dda29 100644 --- a/codex-rs/core/src/parse_command.rs +++ b/codex-rs/core/src/parse_command.rs @@ -868,7 +868,7 @@ pub fn parse_command_impl(command: &[String]) -> Vec { let parts = if contains_connectors(&normalized) { split_on_connectors(&normalized) } else { - vec![normalized.clone()] + vec![normalized] }; // Preserve left-to-right execution order for all commands, including bash -c/-lc @@ -1202,7 +1202,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option> { } } else { ParsedCommand::Read { - cmd: cmd.clone(), + cmd: cmd, name, } } @@ -1216,7 +1216,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option> { ParsedCommand::ListFiles { path, cmd, .. } => { if had_connectors { ParsedCommand::ListFiles { - cmd: cmd.clone(), + cmd: cmd, path, } } else { @@ -1231,7 +1231,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option> { } => { if had_connectors { ParsedCommand::Search { - cmd: cmd.clone(), + cmd: cmd, query, path, } diff --git a/codex-rs/core/src/project_doc.rs b/codex-rs/core/src/project_doc.rs index a869b40cb3..549248fc11 100644 --- a/codex-rs/core/src/project_doc.rs +++ b/codex-rs/core/src/project_doc.rs @@ -115,7 +115,7 @@ pub fn discover_project_doc_paths(config: &Config) -> std::io::Result = vec![dir.clone()]; let mut git_root: Option = None; - let mut cursor = dir.clone(); + let mut cursor = dir; while let Some(parent) = cursor.parent() { let git_marker = cursor.join(".git"); let git_exists = match std::fs::metadata(&git_marker) { diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rs index ae4708976f..8b0586fbaf 100644 --- a/codex-rs/exec/src/event_processor_with_human_output.rs +++ b/codex-rs/exec/src/event_processor_with_human_output.rs @@ -280,7 +280,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { parsed_cmd: _, }) => { self.call_id_to_command.insert( - call_id.clone(), + call_id, ExecCommandBegin { command: command.clone(), }, @@ -382,7 +382,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { // Store metadata so we can calculate duration later when we // receive the corresponding PatchApplyEnd event. self.call_id_to_patch.insert( - call_id.clone(), + call_id, PatchApplyBegin { start_time: Instant::now(), auto_approved, diff --git a/codex-rs/login/src/server.rs b/codex-rs/login/src/server.rs index e267652dda..6a64d96f61 100644 --- a/codex-rs/login/src/server.rs +++ b/codex-rs/login/src/server.rs @@ -42,7 +42,7 @@ impl ServerOptions { pub fn new(codex_home: PathBuf, client_id: String) -> Self { Self { codex_home, - client_id: client_id.to_string(), + client_id: client_id, issuer: DEFAULT_ISSUER.to_string(), port: DEFAULT_PORT, open_browser: true, @@ -126,7 +126,7 @@ pub fn run_login_server(opts: ServerOptions) -> io::Result { let shutdown_notify = Arc::new(tokio::sync::Notify::new()); let server_handle = { let shutdown_notify = shutdown_notify.clone(); - let server = server.clone(); + let server = server; tokio::spawn(async move { let result = loop { tokio::select! { diff --git a/codex-rs/mcp-server/src/codex_tool_runner.rs b/codex-rs/mcp-server/src/codex_tool_runner.rs index feeb7f018a..be948329fd 100644 --- a/codex-rs/mcp-server/src/codex_tool_runner.rs +++ b/codex-rs/mcp-server/src/codex_tool_runner.rs @@ -222,7 +222,7 @@ async fn run_codex_tool_session_inner( } EventMsg::TaskComplete(TaskCompleteEvent { last_agent_message }) => { let text = match last_agent_message { - Some(msg) => msg.clone(), + Some(msg) => msg, None => "".to_string(), }; let result = CallToolResult { diff --git a/codex-rs/mcp-server/src/message_processor.rs b/codex-rs/mcp-server/src/message_processor.rs index 8018095d2a..af954f8ae4 100644 --- a/codex-rs/mcp-server/src/message_processor.rs +++ b/codex-rs/mcp-server/src/message_processor.rs @@ -532,7 +532,7 @@ impl MessageProcessor { // Spawn the long-running reply handler. tokio::spawn({ - let codex = codex.clone(); + let codex = codex; let outgoing = outgoing.clone(); let prompt = prompt.clone(); let running_requests_id_to_codex_uuid = running_requests_id_to_codex_uuid.clone(); diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 12cd789c5f..b2f91682a6 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -304,7 +304,7 @@ impl App { } pub(crate) fn token_usage(&self) -> codex_core::protocol::TokenUsage { - self.chat_widget.token_usage().clone() + self.chat_widget.token_usage() } async fn handle_key_event(&mut self, tui: &mut tui::Tui, key_event: KeyEvent) { diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index c94144bf1e..1300d27b3f 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -483,7 +483,7 @@ impl ChatComposer { } => { // Hide popup without modifying text, remember token to avoid immediate reopen. if let Some(tok) = Self::current_at_token(&self.textarea) { - self.dismissed_file_popup_token = Some(tok.to_string()); + self.dismissed_file_popup_token = Some(tok); } self.active_popup = ActivePopup::None; (InputResult::None, true) @@ -542,7 +542,7 @@ impl ChatComposer { Some(ext) if ext == "jpg" || ext == "jpeg" => "JPEG", _ => "IMG", }; - self.attach_image(path_buf.clone(), w, h, format_label); + self.attach_image(path_buf, w, h, format_label); // Add a trailing space to keep typing fluid. self.textarea.insert_str(" "); } else { diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rs index 07b6077587..8b7dc8fe33 100644 --- a/codex-rs/tui/src/bottom_pane/textarea.rs +++ b/codex-rs/tui/src/bottom_pane/textarea.rs @@ -650,7 +650,7 @@ impl TextArea { fn add_element(&mut self, range: Range) { let elem = TextElement { - range: range.clone(), + range: range, }; self.elements.push(elem); self.elements.sort_by_key(|e| e.range.start); diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index dca821f255..c93f176ae9 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -574,14 +574,14 @@ impl ChatWidget { self.active_exec_cell = Some(history_cell::new_active_exec_command( ev.call_id.clone(), ev.command.clone(), - ev.parsed_cmd.clone(), + ev.parsed_cmd, )); } } else { self.active_exec_cell = Some(history_cell::new_active_exec_command( ev.call_id.clone(), ev.command.clone(), - ev.parsed_cmd.clone(), + ev.parsed_cmd, )); } @@ -804,7 +804,7 @@ impl ChatWidget { "attach_image path={path:?} width={width} height={height} format={format_label}", ); self.bottom_pane - .attach_image(path.clone(), width, height, format_label); + .attach_image(path, width, height, format_label); self.request_redraw(); } @@ -986,7 +986,7 @@ impl ChatWidget { // Only show the text portion in conversation history. if !text.is_empty() { - self.add_to_history(history_cell::new_user_prompt(text.clone())); + self.add_to_history(history_cell::new_user_prompt(text)); } } @@ -1055,10 +1055,10 @@ impl ChatWidget { EventMsg::PlanUpdate(update) => self.on_plan_update(update), EventMsg::ExecApprovalRequest(ev) => { // For replayed events, synthesize an empty id (these should not occur). - self.on_exec_approval_request(id.clone().unwrap_or_default(), ev) + self.on_exec_approval_request(id.unwrap_or_default(), ev) } EventMsg::ApplyPatchApprovalRequest(ev) => { - self.on_apply_patch_approval_request(id.clone().unwrap_or_default(), ev) + self.on_apply_patch_approval_request(id.unwrap_or_default(), ev) } EventMsg::ExecCommandBegin(ev) => self.on_exec_command_begin(ev), EventMsg::ExecCommandOutputDelta(delta) => self.on_exec_command_output_delta(delta), diff --git a/codex-rs/tui/src/chatwidget/agent.rs b/codex-rs/tui/src/chatwidget/agent.rs index 3d2de5c084..bf15b6c4ad 100644 --- a/codex-rs/tui/src/chatwidget/agent.rs +++ b/codex-rs/tui/src/chatwidget/agent.rs @@ -20,7 +20,7 @@ pub(crate) fn spawn_agent( ) -> UnboundedSender { let (codex_op_tx, mut codex_op_rx) = unbounded_channel::(); - let app_event_tx_clone = app_event_tx.clone(); + let app_event_tx_clone = app_event_tx; tokio::spawn(async move { let NewConversation { conversation_id: _, @@ -71,7 +71,7 @@ pub(crate) fn spawn_agent_from_existing( ) -> UnboundedSender { let (codex_op_tx, mut codex_op_rx) = unbounded_channel::(); - let app_event_tx_clone = app_event_tx.clone(); + let app_event_tx_clone = app_event_tx; tokio::spawn(async move { // Forward the captured `SessionConfigured` event so it can be rendered in the UI. let ev = codex_core::protocol::Event { diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index a7be1d6560..b3b45774c1 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -697,7 +697,7 @@ fn spinner(start_time: Option) -> Span<'static> { pub(crate) fn new_active_mcp_tool_call(invocation: McpInvocation) -> PlainHistoryCell { let title_line = Line::from(vec!["tool".magenta(), " running...".dim()]); - let lines: Vec = vec![title_line, format_mcp_invocation(invocation.clone())]; + let lines: Vec = vec![title_line, format_mcp_invocation(invocation)]; PlainHistoryCell { lines } } @@ -1324,7 +1324,7 @@ fn format_mcp_invocation<'a>(invocation: McpInvocation) -> Line<'a> { let invocation_spans = vec![ invocation.server.clone().cyan(), ".".into(), - invocation.tool.clone().cyan(), + invocation.tool.cyan(), "(".into(), args_str.dim(), ")".into(), diff --git a/codex-rs/tui/src/onboarding/onboarding_screen.rs b/codex-rs/tui/src/onboarding/onboarding_screen.rs index a43b4c0f9b..e38dc0efe2 100644 --- a/codex-rs/tui/src/onboarding/onboarding_screen.rs +++ b/codex-rs/tui/src/onboarding/onboarding_screen.rs @@ -71,7 +71,7 @@ impl OnboardingScreen { } = args; let preferred_auth_method = config.preferred_auth_method; let cwd = config.cwd.clone(); - let codex_home = config.codex_home.clone(); + let codex_home = config.codex_home; let mut steps: Vec = vec![Step::Welcome(WelcomeWidget { is_logged_in: !matches!(login_status, LoginStatus::NotAuthenticated), })]; diff --git a/codex-rs/tui/src/user_approval_widget.rs b/codex-rs/tui/src/user_approval_widget.rs index 4f1739554a..410766e0fe 100644 --- a/codex-rs/tui/src/user_approval_widget.rs +++ b/codex-rs/tui/src/user_approval_widget.rs @@ -244,7 +244,7 @@ impl UserApprovalWidget { "You ".into(), "approved".bold(), " codex to run ".into(), - snippet.clone().dim(), + snippet.dim(), " this time".bold(), ]); } @@ -254,7 +254,7 @@ impl UserApprovalWidget { "You ".into(), "approved".bold(), " codex to run ".into(), - snippet.clone().dim(), + snippet.dim(), " every time this session".bold(), ]); } @@ -264,7 +264,7 @@ impl UserApprovalWidget { "You ".into(), "did not approve".bold(), " codex to run ".into(), - snippet.clone().dim(), + snippet.dim(), ]); } ReviewDecision::Abort => { @@ -273,7 +273,7 @@ impl UserApprovalWidget { "You ".into(), "canceled".bold(), " the request to run ".into(), - snippet.clone().dim(), + snippet.dim(), ]); } }