Lightweight coding agent that runs in your terminal
Rust
chore: enable clippy::redundant_clone (#3489)
Michael Bolinbec51f6c05ca
diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.tomlindex 4155992293..1502e62f2f 100644--- a/codex-rs/Cargo.toml+++ b/codex-rs/Cargo.toml@@ -34,6 +34,7 @@ rust = {}[workspace.lints.clippy]expect_used = "deny"+redundant_clone = "deny"uninlined_format_args = "deny"unwrap_used = "deny"diff --git a/codex-rs/apply-patch/src/parser.rs b/codex-rs/apply-patch/src/parser.rsindex 3b89c4da85..768c89ad78 100644--- a/codex-rs/apply-patch/src/parser.rs+++ b/codex-rs/apply-patch/src/parser.rs@@ -617,7 +617,7 @@ fn test_parse_patch_lenient() {assert_eq!(parse_patch_text(&patch_text_in_double_quoted_heredoc, ParseMode::Lenient),Ok(ApplyPatchArgs {- hunks: expected_patch.clone(),+ hunks: expected_patch,patch: patch_text.to_string(),workdir: None,})@@ -637,7 +637,7 @@ fn test_parse_patch_lenient() {"<<EOF\n*** Begin Patch\n*** Update File: file2.py\nEOF\n".to_string();assert_eq!(parse_patch_text(&patch_text_with_missing_closing_heredoc, ParseMode::Strict),- Err(expected_error.clone())+ Err(expected_error));assert_eq!(parse_patch_text(&patch_text_with_missing_closing_heredoc, ParseMode::Lenient),diff --git a/codex-rs/core/src/auth.rs b/codex-rs/core/src/auth.rsindex e2dd1d73d4..fe882c5dc4 100644--- a/codex-rs/core/src/auth.rs+++ b/codex-rs/core/src/auth.rs@@ -131,8 +131,7 @@ impl CodexAuth {}pub fn get_account_id(&self) -> Option<String> {- self.get_current_token_data()- .and_then(|t| t.account_id.clone())+ self.get_current_token_data().and_then(|t| t.account_id)}pub fn get_plan_type(&self) -> Option<String> {@@ -146,7 +145,7 @@ impl CodexAuth {}fn get_current_token_data(&self) -> Option<TokenData> {- 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.@@ -291,10 +290,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.rsindex adfaca19c5..b48093d8f4 100644--- a/codex-rs/core/src/codex.rs+++ b/codex-rs/core/src/codex.rs@@ -214,12 +214,7 @@ impl Codex {let conversation_id = session.conversation_id;// This task will run until Op::Shutdown is received.- tokio::spawn(submission_loop(- session.clone(),- turn_context,- config,- rx_sub,- ));+ tokio::spawn(submission_loop(session, turn_context, config, rx_sub));let codex = Codex {next_id: AtomicU64::new(0),tx_sub,@@ -1074,7 +1069,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;});@@ -1772,7 +1767,7 @@ async fn try_run_turn(}}).map(|call_id| ResponseItem::CustomToolCallOutput {- call_id: call_id.clone(),+ call_id,output: "aborted".to_string(),}).collect::<Vec<_>>()@@ -1792,7 +1787,7 @@ async fn try_run_turn(cwd: turn_context.cwd.clone(),approval_policy: turn_context.approval_policy,sandbox_policy: turn_context.sandbox_policy.clone(),- model: turn_context.client.get_model().clone(),+ model: turn_context.client.get_model(),effort: turn_context.client.get_reasoning_effort(),summary: turn_context.client.get_reasoning_summary(),});@@ -3154,7 +3149,7 @@ mod tests {exit_code: 0,stdout: StreamOutput::new(String::new()),stderr: StreamOutput::new(String::new()),- aggregated_output: StreamOutput::new(full.clone()),+ aggregated_output: StreamOutput::new(full),duration: StdDuration::from_secs(1),};@@ -3188,7 +3183,7 @@ mod tests {fn model_truncation_respects_byte_budget() {// Construct a large output (about 100kB) so byte budget dominateslet big_line = "x".repeat(100);- let full = std::iter::repeat_n(big_line.clone(), 1000)+ let full = std::iter::repeat_n(big_line, 1000).collect::<Vec<_>>().join("\n");diff --git a/codex-rs/core/src/environment_context.rs b/codex-rs/core/src/environment_context.rsindex 1d755841e8..89af9e1c91 100644--- a/codex-rs/core/src/environment_context.rs+++ b/codex-rs/core/src/environment_context.rs@@ -63,7 +63,7 @@ impl EnvironmentContext {if writable_roots.is_empty() {None} else {- Some(writable_roots.clone())+ Some(writable_roots)}}_ => None,diff --git a/codex-rs/core/src/event_mapping.rs b/codex-rs/core/src/event_mapping.rsindex 2628de4281..3ae7f78516 100644--- a/codex-rs/core/src/event_mapping.rs+++ b/codex-rs/core/src/event_mapping.rs@@ -159,7 +159,7 @@ mod tests {EventMsg::UserMessage(user) => {assert_eq!(user.message, "Hello world");assert!(matches!(user.kind, Some(InputMessageKind::Plain)));- assert_eq!(user.images, Some(vec![img1.clone(), img2.clone()]));+ assert_eq!(user.images, Some(vec![img1, img2]));}other => panic!("expected UserMessage, got {other:?}"),}diff --git a/codex-rs/core/src/git_info.rs b/codex-rs/core/src/git_info.rsindex 619f4f52de..ca62ad499e 100644--- a/codex-rs/core/src/git_info.rs+++ b/codex-rs/core/src/git_info.rs@@ -802,7 +802,7 @@ mod tests {async fn resolve_root_git_project_for_trust_regular_repo_returns_repo_root() {let temp_dir = TempDir::new().expect("Failed to create temp dir");let repo_path = create_test_git_repo(&temp_dir).await;- let expected = std::fs::canonicalize(&repo_path).unwrap().to_path_buf();+ let expected = std::fs::canonicalize(&repo_path).unwrap();assert_eq!(resolve_root_git_project_for_trust(&repo_path),@@ -810,10 +810,7 @@ mod tests {);let nested = repo_path.join("sub/dir");std::fs::create_dir_all(&nested).unwrap();- assert_eq!(- resolve_root_git_project_for_trust(&nested),- Some(expected.clone())- );+ assert_eq!(resolve_root_git_project_for_trust(&nested), Some(expected));}#[tokio::test]diff --git a/codex-rs/core/src/parse_command.rs b/codex-rs/core/src/parse_command.rsindex 15dd2ff411..ea886d61f0 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<ParsedCommand> {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@@ -1201,10 +1201,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option<Vec<ParsedCommand>> {name,}} else {- ParsedCommand::Read {- cmd: cmd.clone(),- name,- }+ ParsedCommand::Read { cmd, name }}} else {ParsedCommand::Read {@@ -1215,10 +1212,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option<Vec<ParsedCommand>> {}ParsedCommand::ListFiles { path, cmd, .. } => {if had_connectors {- ParsedCommand::ListFiles {- cmd: cmd.clone(),- path,- }+ ParsedCommand::ListFiles { cmd, path }} else {ParsedCommand::ListFiles {cmd: shlex_join(&script_tokens),@@ -1230,11 +1224,7 @@ fn parse_bash_lc_commands(original: &[String]) -> Option<Vec<ParsedCommand>> {query, path, cmd, ..} => {if had_connectors {- ParsedCommand::Search {- cmd: cmd.clone(),- query,- path,- }+ ParsedCommand::Search { cmd, query, path }} else {ParsedCommand::Search {cmd: shlex_join(&script_tokens),diff --git a/codex-rs/core/src/project_doc.rs b/codex-rs/core/src/project_doc.rsindex 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<PathBu// Build chain from cwd upwards and detect git root.let mut chain: Vec<PathBuf> = vec![dir.clone()];let mut git_root: Option<PathBuf> = 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/core/src/rollout/tests.rs b/codex-rs/core/src/rollout/tests.rsindex ecff658d29..86f47645f9 100644--- a/codex-rs/core/src/rollout/tests.rs+++ b/codex-rs/core/src/rollout/tests.rs@@ -305,7 +305,7 @@ async fn test_pagination_cursor() {path: p1,head: head_1,}],- next_cursor: Some(expected_cursor3.clone()),+ next_cursor: Some(expected_cursor3),num_scanned_files: 5, // scanned 05, 04 (anchor), 03, 02 (anchor), 01reached_scan_cap: false,};@@ -344,7 +344,7 @@ async fn test_get_conversation_contents() {let expected_cursor: Cursor = serde_json::from_str(&format!("\"{ts}|{uuid}\"")).unwrap();let expected_page = ConversationsPage {items: vec![ConversationItem {- path: expected_path.clone(),+ path: expected_path,head: expected_head,}],next_cursor: Some(expected_cursor),@@ -437,7 +437,7 @@ async fn test_stable_ordering_same_second_pagination() {path: p1,head: head(u1),}],- next_cursor: Some(expected_cursor2.clone()),+ next_cursor: Some(expected_cursor2),num_scanned_files: 3, // scanned u3, u2 (anchor), u1reached_scan_cap: false,};diff --git a/codex-rs/core/src/safety.rs b/codex-rs/core/src/safety.rsindex 790267f55a..42b1ffdff9 100644--- a/codex-rs/core/src/safety.rs+++ b/codex-rs/core/src/safety.rs@@ -293,7 +293,7 @@ mod tests {// With the parent dir explicitly added as a writable root, the// outside write should be permitted.let policy_with_parent = SandboxPolicy::WorkspaceWrite {- writable_roots: vec![parent.clone()],+ writable_roots: vec![parent],network_access: false,exclude_tmpdir_env_var: true,exclude_slash_tmp: true,diff --git a/codex-rs/core/src/seatbelt.rs b/codex-rs/core/src/seatbelt.rsindex 31aa770d2e..285e5d5691 100644--- a/codex-rs/core/src/seatbelt.rs+++ b/codex-rs/core/src/seatbelt.rs@@ -153,7 +153,7 @@ mod tests {// Build a policy that only includes the two test roots as writable and// does not automatically include defaults TMPDIR or /tmp.let policy = SandboxPolicy::WorkspaceWrite {- writable_roots: vec![root_with_git.clone(), root_without_git.clone()],+ writable_roots: vec![root_with_git, root_without_git],network_access: false,exclude_tmpdir_env_var: true,exclude_slash_tmp: true,diff --git a/codex-rs/core/src/shell.rs b/codex-rs/core/src/shell.rsindex 7ef79076e0..1734d5de65 100644--- a/codex-rs/core/src/shell.rs+++ b/codex-rs/core/src/shell.rs@@ -326,10 +326,7 @@ mod tests {.format_default_shell_invocation(input.iter().map(|s| s.to_string()).collect());let expected_cmd = expected_cmd.iter()- .map(|s| {- s.replace("BASHRC_PATH", bashrc_path.to_str().unwrap())- .to_string()- })+ .map(|s| s.replace("BASHRC_PATH", bashrc_path.to_str().unwrap())).collect();assert_eq!(actual_cmd, Some(expected_cmd));@@ -435,10 +432,7 @@ mod macos_tests {.format_default_shell_invocation(input.iter().map(|s| s.to_string()).collect());let expected_cmd = expected_cmd.iter()- .map(|s| {- s.replace("ZSHRC_PATH", zshrc_path.to_str().unwrap())- .to_string()- })+ .map(|s| s.replace("ZSHRC_PATH", zshrc_path.to_str().unwrap())).collect();assert_eq!(actual_cmd, Some(expected_cmd));diff --git a/codex-rs/core/src/turn_diff_tracker.rs b/codex-rs/core/src/turn_diff_tracker.rsindex 2157ed1784..6c12d6cd46 100644--- a/codex-rs/core/src/turn_diff_tracker.rs+++ b/codex-rs/core/src/turn_diff_tracker.rs@@ -678,7 +678,7 @@ index {left_oid}..{right_oid}let dest = dir.path().join("dest.txt");let mut acc = TurnDiffTracker::new();let mv = HashMap::from([(- src.clone(),+ src,FileChange::Update {unified_diff: "".into(),move_path: Some(dest.clone()),diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rsindex 3c879397bd..c80117706b 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/exec/tests/suite/common.rs b/codex-rs/exec/tests/suite/common.rsindex 8c57e7afcb..4a3719aaba 100644--- a/codex-rs/exec/tests/suite/common.rs+++ b/codex-rs/exec/tests/suite/common.rs@@ -61,7 +61,7 @@ pub(crate) async fn run_e2e_exec_test(cwd: &Path, response_streams: Vec<String>).context("should find binary for codex-exec").expect("should find binary for codex-exec").current_dir(cwd.clone())- .env("CODEX_HOME", cwd.clone())+ .env("CODEX_HOME", cwd).env("OPENAI_API_KEY", "dummy").env("OPENAI_BASE_URL", format!("{uri}/v1")).arg("--skip-git-repo-check")diff --git a/codex-rs/execpolicy/src/execv_checker.rs b/codex-rs/execpolicy/src/execv_checker.rsindex fcd80b2b5f..ae61d54cf8 100644--- a/codex-rs/execpolicy/src/execv_checker.rs+++ b/codex-rs/execpolicy/src/execv_checker.rs@@ -88,7 +88,7 @@ impl ExecvChecker {let mut program = valid_exec.program.to_string();for system_path in valid_exec.system_path {if is_executable_file(&system_path) {- program = system_path.to_string();+ program = system_path;break;}}@@ -196,7 +196,7 @@ system_path=[{fake_cp:?}]let checker = setup(&fake_cp);let exec_call = ExecCall {program: "cp".into(),- args: vec![source.clone(), dest.clone()],+ args: vec![source, dest.clone()],};let valid_exec = match checker.r#match(&exec_call)? {MatchedExec::Match { exec } => exec,@@ -207,7 +207,7 @@ system_path=[{fake_cp:?}]assert_eq!(checker.check(valid_exec.clone(), &cwd, &[], &[]),Err(ReadablePathNotInReadableFolders {- file: source_path.clone(),+ file: source_path,folders: vec![]}),);@@ -229,7 +229,7 @@ system_path=[{fake_cp:?}]// Both readable and writeable folders specified.assert_eq!(checker.check(- valid_exec.clone(),+ valid_exec,&cwd,std::slice::from_ref(&root_path),std::slice::from_ref(&root_path)@@ -241,7 +241,7 @@ system_path=[{fake_cp:?}]// folders.let exec_call_folders_as_args = ExecCall {program: "cp".into(),- args: vec![root.clone(), root.clone()],+ args: vec![root.clone(), root],};let valid_exec_call_folders_as_args = match checker.r#match(&exec_call_folders_as_args)? {MatchedExec::Match { exec } => exec,@@ -254,7 +254,7 @@ system_path=[{fake_cp:?}]std::slice::from_ref(&root_path),std::slice::from_ref(&root_path)),- Ok(cp.clone()),+ Ok(cp),);// Specify a parent of a readable folder as input.diff --git a/codex-rs/execpolicy/src/policy_parser.rs b/codex-rs/execpolicy/src/policy_parser.rsindex 254c12d7aa..b065c109a8 100644--- a/codex-rs/execpolicy/src/policy_parser.rs+++ b/codex-rs/execpolicy/src/policy_parser.rs@@ -104,7 +104,7 @@ impl PolicyBuilder {info!("adding program spec: {program_spec:?}");let name = program_spec.program.clone();let mut programs = self.programs.borrow_mut();- programs.insert(name.clone(), program_spec);+ programs.insert(name, program_spec);}fn add_forbidden_substrings(&self, substrings: &[String]) {diff --git a/codex-rs/login/src/server.rs b/codex-rs/login/src/server.rsindex e267652dda..2cf1189f4c 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,issuer: DEFAULT_ISSUER.to_string(),port: DEFAULT_PORT,open_browser: true,@@ -126,7 +126,7 @@ pub fn run_login_server(opts: ServerOptions) -> io::Result<LoginServer> {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.rsindex d3351faa88..226408f805 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.rsindex a108b7555e..c696d4538b 100644--- a/codex-rs/mcp-server/src/message_processor.rs+++ b/codex-rs/mcp-server/src/message_processor.rs@@ -531,7 +531,6 @@ impl MessageProcessor {// Spawn the long-running reply handler.tokio::spawn({- let codex = codex.clone();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/mcp-server/src/outgoing_message.rs b/codex-rs/mcp-server/src/outgoing_message.rsindex 5ce2e99423..939d986aec 100644--- a/codex-rs/mcp-server/src/outgoing_message.rs+++ b/codex-rs/mcp-server/src/outgoing_message.rs@@ -299,7 +299,7 @@ mod tests {let Ok(expected_params) = serde_json::to_value(&event) else {panic!("Event must serialize");};- assert_eq!(params, Some(expected_params.clone()));+ assert_eq!(params, Some(expected_params));}#[tokio::test]diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rsindex 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.rsindex 14094badea..410701a629 100644--- a/codex-rs/tui/src/bottom_pane/chat_composer.rs+++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs@@ -487,7 +487,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)@@ -546,7 +546,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 {@@ -2123,7 +2123,7 @@ mod tests {// Re-add and test backspace in middle: should break the placeholder string// and drop the image mapping (same as text placeholder behavior).- composer.attach_image(path.clone(), 20, 10, "PNG");+ composer.attach_image(path, 20, 10, "PNG");let placeholder2 = composer.attached_images[0].placeholder.clone();// Move cursor to roughly middle of placeholderif let Some(start_pos) = composer.textarea.text().find(&placeholder2) {@@ -2182,7 +2182,7 @@ mod tests {let path1 = PathBuf::from("/tmp/image_dup1.png");let path2 = PathBuf::from("/tmp/image_dup2.png");- composer.attach_image(path1.clone(), 10, 5, "PNG");+ composer.attach_image(path1, 10, 5, "PNG");// separate placeholders with a space for claritycomposer.handle_paste(" ".into());composer.attach_image(path2.clone(), 10, 5, "PNG");@@ -2231,7 +2231,7 @@ mod tests {assert!(composer.textarea.text().starts_with("[image 3x2 PNG] "));let imgs = composer.take_recent_submission_images();- assert_eq!(imgs, vec![tmp_path.clone()]);+ assert_eq!(imgs, vec![tmp_path]);}#[test]diff --git a/codex-rs/tui/src/bottom_pane/mod.rs b/codex-rs/tui/src/bottom_pane/mod.rsindex 8d84ccc121..f30bd418e9 100644--- a/codex-rs/tui/src/bottom_pane/mod.rs+++ b/codex-rs/tui/src/bottom_pane/mod.rs@@ -564,7 +564,7 @@ mod tests {let (tx_raw, rx) = unbounded_channel::<AppEvent>();let tx = AppEventSender::new(tx_raw);let mut pane = BottomPane::new(BottomPaneParams {- app_event_tx: tx.clone(),+ app_event_tx: tx,frame_requester: FrameRequester::test_dummy(),has_input_focus: true,enhanced_keys_supported: false,diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rsindex 07b6077587..9166b8c7f6 100644--- a/codex-rs/tui/src/bottom_pane/textarea.rs+++ b/codex-rs/tui/src/bottom_pane/textarea.rs@@ -649,9 +649,7 @@ impl TextArea {}fn add_element(&mut self, range: Range<usize>) {- let elem = TextElement {- range: range.clone(),- };+ let elem = TextElement { 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.rsindex 7f9ea76538..2756db2231 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.rsindex 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<Op> {let (codex_op_tx, mut codex_op_rx) = unbounded_channel::<Op>();- 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<Op> {let (codex_op_tx, mut codex_op_rx) = unbounded_channel::<Op>();- 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/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rsindex aad6e83913..c148b8670b 100644--- a/codex-rs/tui/src/chatwidget/tests.rs+++ b/codex-rs/tui/src/chatwidget/tests.rs@@ -352,7 +352,7 @@ fn exec_approval_decision_truncates_multiline_and_long_commands() {let long = format!("echo {}", "a".repeat(200));let ev_long = ExecApprovalRequestEvent {call_id: "call-long".into(),- command: vec!["bash".into(), "-lc".into(), long.clone()],+ command: vec!["bash".into(), "-lc".into(), long],cwd: std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),reason: None,};diff --git a/codex-rs/tui/src/diff_render.rs b/codex-rs/tui/src/diff_render.rsindex 06afd85ca6..20d26106b2 100644--- a/codex-rs/tui/src/diff_render.rs+++ b/codex-rs/tui/src/diff_render.rs@@ -737,10 +737,10 @@ mod tests {let mut changes: HashMap<PathBuf, FileChange> = HashMap::new();changes.insert(- abs_old.clone(),+ abs_old,FileChange::Update {unified_diff: patch,- move_path: Some(abs_new.clone()),+ move_path: Some(abs_new),},);diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rsindex 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<Instant>) -> 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<Line> = vec![title_line, format_mcp_invocation(invocation.clone())];+ let lines: Vec<Line> = 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/auth.rs b/codex-rs/tui/src/onboarding/auth.rsindex 97a6b7c21c..d419badada 100644--- a/codex-rs/tui/src/onboarding/auth.rs+++ b/codex-rs/tui/src/onboarding/auth.rs@@ -432,7 +432,7 @@ impl AuthModeWidget {match &mut *guard {SignInState::ApiKeyEntry(state) => {if state.value.is_empty() {- if let Some(prefill) = prefill_from_env.clone() {+ if let Some(prefill) = prefill_from_env {state.value = prefill;state.prepopulated_from_env = true;} else {diff --git a/codex-rs/tui/src/onboarding/onboarding_screen.rs b/codex-rs/tui/src/onboarding/onboarding_screen.rsindex 29bf2e5bc5..c9617d796b 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 {config,} = args;let cwd = config.cwd.clone();- let codex_home = config.codex_home.clone();+ let codex_home = config.codex_home;let mut steps: Vec<Step> = 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.rsindex 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(),]);}}