🧹 Refactor unsafe unwrap() calls in native_emit/uf2.rs tests - #322
🧹 Refactor unsafe unwrap() calls in native_emit/uf2.rs tests#322undivisible wants to merge 1 commit into
Conversation
…rator Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_948dbd78-30dc-4bcb-8d47-9b39636f4365) |
|
Tick the box to add this pull request to the merge queue (same as
|
🎯 What: The test functions
encodes_single_block_with_familyandsplits_large_payloadinin-cli/src/native_emit/uf2.rswere using unsafeunwrap()andexpect()calls, which could cause abrupt panics.💡 Why: Modifying the test signatures to return
Result<(), Box<dyn std::error::Error>>and replacing.unwrap()/.expect()with the?operator ensures robust error handling and follows idiomatic Rust testing practices without altering test behavior.✅ Verification: Ran
cd in-cli && cargo fmt,cargo clippy --all-targets --features extended --locked -- -D warnings, andcargo test uf2. All test suites pass with no regressions.✨ Result: Enhanced the maintainability and reliability of the codebase by replacing unsafe panic behavior with idiomatic error propagation.
PR created automatically by Jules for task 5772482188214198352 started by @undivisible
Note
Low Risk
Test-only refactor in
native_emit/uf2.rs; no runtime or encoding logic changes.Overview
Refactors two UF2 encoder unit tests in
uf2.rsso they returnResult<(), Box<dyn std::error::Error>>instead of panicking via.expect()and.unwrap().encodes_single_block_with_familyandsplits_large_payloadnow propagate failures fromencode_uf2andtry_into()with?, end withOk(()), and include a small assert layout cleanup.rejects_emptyis unchanged and still usesexpect_err. Productionencode_uf2behavior is untouched.Reviewed by Cursor Bugbot for commit 795e97b. Configure here.