Instruction file imported from bug-ops/zeph (
.github/instructions/rust.instructions.md). Copyright stays with the author.
Rust File Review
Lints
- Workspace Clippy lints
clippy::all+clippy::pedanticare configured as warnings inCargo.toml - Review policy: prefer
#![forbid(unsafe_code)]in crates and reject newunsafeblocks unless strictly justified and well-documented - Review policy: avoid
unwrap()andexpect()in non-test code; require explicit error handling instead
Async Patterns
- Use native async trait methods (Edition 2024)
- Use
Pin<Box<dyn Future<...> + Send + '_>>only when trait object safety requires it - Runtime:
tokiowith#[tokio::main]entry point
Type Conventions
- Type aliases for complex pinned types:
type ChatStream = Pin<Box<dyn Stream<...> + Send>> - Re-export public API at crate root via
pub useinlib.rs - Serde:
#[serde(tag = "kind")]for enums with data,#[serde(rename_all = "camelCase")]for A2A types
Test Code
- Unit tests in inline
#[cfg(test)] mod testsat module end - Mock types (MockProvider, MockChannel) inside
#[cfg(test)]blocks implementing the real trait - Use
tempfilefor filesystem fixtures,testcontainersfor Qdrant - Tests sharing state require
#[serial]attribute