DemesneGH opened a new pull request, #229: URL: https://github.com/apache/teaclave-trustzone-sdk/pull/229
This PR enforces `-D clippy::unwrap_used -D clippy::expect_used -D clippy::panic` for all examples and fixes the resulting Clippy errors. Most issues were resolved by replacing `unwrap()` with the `?` operator. A few special cases required additional changes: * **UUID error handling**: Modified `uuid.rs` in `optee-teec` and `optee-utee` to return `optee-*::Error` instead of `uuid::parser::ParseError`. Since `uuid.rs` belongs to the `optee-*` crates, it is more consistent to return the same `Result` type as other modules. This also eliminates many `unwrap()` calls when parsing UUIDs in hosts and TAs. * **Simplified error returns**: Leveraged existing conversion ``` impl From<ErrorKind> for Error { #[inline] fn from(kind: ErrorKind) -> Error { Error { kind, origin: None } } } ``` to simplify error handling (if the Error doesn't specify `origin`), e.g.: * `.ok_or(Error::new(ErrorKind::BadParameters))?;` → `.ok_or(ErrorKind::BadParameters)?;` * `return Err(Error::new(ErrorKind::Generic));` → `return Err(ErrorKind::Generic.into());` * **Testcase exceptions**: Allowed `expect` in test-related code, such as `uuid.rs` in `optee-*` and `examples/error_handling-rs/host` (which behaves more like a testcase than an example). ---- **Clippy Enforcement Plan** 1. [DONE] All examples: enable default Clippy + compiler checks ([[#224](https://github.com/apache/teaclave-trustzone-sdk/pull/224)](https://github.com/apache/teaclave-trustzone-sdk/pull/224)). 2. All examples: enable advanced panic checks (this PR). 3. [TODO] `optee-*` crates: enable default Clippy checks. 4. [TODO]`optee-*` crates: enable advanced Clippy checks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For additional commands, e-mail: dev-h...@teaclave.apache.org