Replace .lock().unwrap() with .expect() for better mutex poisoning diagnostics#303
Conversation
…ssages Co-authored-by: karthiknadig <3840081+karthiknadig@users.noreply.github.com>
PR ReviewSummaryThis PR addresses issue #289 by replacing Positive Aspects
Minor IssueTypo in field name: In .expect("envoronment mutex poisoned")Consider fixing the typo either in this PR or as a follow-up. VerificationThe changes are mechanical and safe:
RecommendationApprove - The PR achieves its stated goal. The typo is a pre-existing issue and not a blocker. |
rzhao271
left a comment
There was a problem hiding this comment.
I forgot this was using Rust.
The codebase had 39 occurrences of
.lock().unwrap()in source files. These provide no context when mutex poisoning occurs, making debugging difficult.Changes
.lock().unwrap()with.expect("<mutex_name> mutex poisoned")in 12 source filespet-core/src/lib.rsto follow the new patternBefore
After
Files Modified
pet-python-utils/src/cache.rs,env.rspet-reporter/src/collect.rs,stdio.rspet-core/src/os_environment.rs,lib.rspet-pyenv/src/lib.rspet-uv/src/lib.rspet-windows-registry/src/lib.rspet/src/jsonrpc.rs,find.rs,lib.rsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.