mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
e752f7b4ae
The workspace denies `clippy::expect_used` in production. Although `clippy.toml` allows `expect` in tests, Bazel Clippy compiles integration-test helper code in a way that does not receive that exemption, which encouraged verbose `unwrap_or_else(... panic!(...))` and equivalent `match`/`let else` forms. This allows `clippy::expect_used` once at each integration-test crate root (including aggregated suites and test-support libraries), then replaces manual panic-based Result and Option unwraps with `expect`/`expect_err`. Standalone `tests/*.rs` files remain their own crate roots. Intentional assertion and unexpected-variant panics remain unchanged, and the production `expect_used = "deny"` lint remains in place. The cleanup is mechanical and net-negative in line count.
25 lines
860 B
Rust
25 lines
860 B
Rust
#![allow(clippy::expect_used)]
|
|
|
|
mod mcp_process;
|
|
mod mock_model_server;
|
|
mod responses;
|
|
|
|
pub use core_test_support::format_with_current_shell;
|
|
pub use core_test_support::format_with_current_shell_display_non_login;
|
|
pub use core_test_support::format_with_current_shell_non_login;
|
|
pub use mcp_process::McpProcess;
|
|
pub use mock_model_server::create_mock_responses_server;
|
|
pub use responses::create_apply_patch_sse_response;
|
|
pub use responses::create_final_assistant_message_sse_response;
|
|
pub use responses::create_shell_command_sse_response;
|
|
use rmcp::model::JsonRpcResponse;
|
|
use serde::de::DeserializeOwned;
|
|
|
|
pub fn to_response<T: DeserializeOwned>(
|
|
response: JsonRpcResponse<serde_json::Value>,
|
|
) -> anyhow::Result<T> {
|
|
let value = serde_json::to_value(response.result)?;
|
|
let codex_response = serde_json::from_value(value)?;
|
|
Ok(codex_response)
|
|
}
|