Lightweight coding agent that runs in your terminal
Rust
chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 (#947)
Michael Bolinec5e82b77c26
diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.ymlindex c4cb75e7d8..a9121a34f5 100644--- a/.github/workflows/rust-ci.yml+++ b/.github/workflows/rust-ci.yml@@ -26,7 +26,9 @@ jobs:steps:- uses: actions/checkout@v4- - uses: dtolnay/rust-toolchain@stable+ - uses: dtolnay/[email protected]+ with:+ components: rustfmt- name: cargo fmtrun: cargo fmt -- --config imports_granularity=Item --check@@ -58,9 +60,10 @@ jobs:steps:- uses: actions/checkout@v4- - uses: dtolnay/rust-toolchain@stable+ - uses: dtolnay/[email protected]with:targets: ${{ matrix.target }}+ components: clippy- uses: actions/cache@v4with:diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex 96c2f1a0a4..7e9e4b4677 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -74,7 +74,7 @@ jobs:steps:- uses: actions/checkout@v4- - uses: dtolnay/rust-toolchain@stable+ - uses: dtolnay/[email protected]with:targets: ${{ matrix.target }}diff --git a/codex-rs/core/src/exec.rs b/codex-rs/core/src/exec.rsindex af09ded0bd..158a0da9b4 100644--- a/codex-rs/core/src/exec.rs+++ b/codex-rs/core/src/exec.rs@@ -349,14 +349,12 @@ pub(crate) async fn consume_truncated_output(// we treat it as an exceptional I/O errorlet stdout_reader = child.stdout.take().ok_or_else(|| {- CodexErr::Io(io::Error::new(- io::ErrorKind::Other,+ CodexErr::Io(io::Error::other("stdout pipe was unexpectedly not available",))})?;let stderr_reader = child.stderr.take().ok_or_else(|| {- CodexErr::Io(io::Error::new(- io::ErrorKind::Other,+ CodexErr::Io(io::Error::other("stderr pipe was unexpectedly not available",))})?;diff --git a/codex-rs/core/src/exec_linux.rs b/codex-rs/core/src/exec_linux.rsindex 22e97ea42b..e74c56219c 100644--- a/codex-rs/core/src/exec_linux.rs+++ b/codex-rs/core/src/exec_linux.rs@@ -51,10 +51,9 @@ pub fn exec_linux(match tool_call_output {Ok(Ok(output)) => Ok(output),Ok(Err(e)) => Err(e),- Err(e) => Err(CodexErr::Io(io::Error::new(- io::ErrorKind::Other,- format!("thread join failed: {e:?}"),- ))),+ Err(e) => Err(CodexErr::Io(io::Error::other(format!(+ "thread join failed: {e:?}"+ )))),}}diff --git a/codex-rs/core/src/rollout.rs b/codex-rs/core/src/rollout.rsindex 80b1f0a3fa..4127b603e8 100644--- a/codex-rs/core/src/rollout.rs+++ b/codex-rs/core/src/rollout.rs@@ -6,7 +6,6 @@use std::fs::File;use std::fs::{self};use std::io::Error as IoError;-use std::io::ErrorKind;use serde::Serialize;use time::OffsetDateTime;@@ -64,9 +63,9 @@ impl RolloutRecorder {let timestamp_format: &[FormatItem] = format_description!("[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond digits:3]Z");- let timestamp = timestamp.format(timestamp_format).map_err(|e| {- IoError::new(ErrorKind::Other, format!("failed to format timestamp: {e}"))- })?;+ let timestamp = timestamp+ .format(timestamp_format)+ .map_err(|e| IoError::other(format!("failed to format timestamp: {e}")))?;let meta = SessionMeta {timestamp,@@ -131,19 +130,13 @@ impl RolloutRecorder {async fn record_item(&self, item: &impl Serialize) -> std::io::Result<()> {// Serialize the item to JSON first so that the writer thread only has// to perform the actual write.- let json = serde_json::to_string(item).map_err(|e| {- IoError::new(- ErrorKind::Other,- format!("failed to serialize response items: {e}"),- )- })?;-- self.tx.send(json).await.map_err(|e| {- IoError::new(- ErrorKind::Other,- format!("failed to queue rollout item: {e}"),- )- })+ let json = serde_json::to_string(item)+ .map_err(|e| IoError::other(format!("failed to serialize response items: {e}")))?;++ self.tx+ .send(json)+ .await+ .map_err(|e| IoError::other(format!("failed to queue rollout item: {e}")))}}@@ -165,7 +158,7 @@ fn create_log_file(config: &Config, session_id: Uuid) -> std::io::Result<LogFilefs::create_dir_all(&dir)?;let timestamp = OffsetDateTime::now_local()- .map_err(|e| IoError::new(ErrorKind::Other, format!("failed to get local time: {e}")))?;+ .map_err(|e| IoError::other(format!("failed to get local time: {e}")))?;// Custom format for YYYY-MM-DDThh-mm-ss. Use `-` instead of `:` for// compatibility with filesystems that do not allow colons in filenames.@@ -173,7 +166,7 @@ fn create_log_file(config: &Config, session_id: Uuid) -> std::io::Result<LogFileformat_description!("[year]-[month]-[day]T[hour]-[minute]-[second]");let date_str = timestamp.format(format)- .map_err(|e| IoError::new(ErrorKind::Other, format!("failed to format timestamp: {e}")))?;+ .map_err(|e| IoError::other(format!("failed to format timestamp: {e}")))?;let filename = format!("rollout-{date_str}-{session_id}.jsonl");diff --git a/codex-rs/mcp-client/src/mcp_client.rs b/codex-rs/mcp-client/src/mcp_client.rsindex 3c6a5218c1..6a9111e69f 100644--- a/codex-rs/mcp-client/src/mcp_client.rs+++ b/codex-rs/mcp-client/src/mcp_client.rs@@ -99,12 +99,14 @@ impl McpClient {.kill_on_drop(true).spawn()?;- let stdin = child.stdin.take().ok_or_else(|| {- std::io::Error::new(std::io::ErrorKind::Other, "failed to capture child stdin")- })?;- let stdout = child.stdout.take().ok_or_else(|| {- std::io::Error::new(std::io::ErrorKind::Other, "failed to capture child stdout")- })?;+ let stdin = child+ .stdin+ .take()+ .ok_or_else(|| std::io::Error::other("failed to capture child stdin"))?;+ let stdout = child+ .stdout+ .take()+ .ok_or_else(|| std::io::Error::other("failed to capture child stdout"))?;let (outgoing_tx, mut outgoing_rx) = mpsc::channel::<JSONRPCMessage>(CHANNEL_CAPACITY);let pending: Arc<Mutex<HashMap<i64, PendingSender>>> = Arc::new(Mutex::new(HashMap::new()));