NEW CONTRIBUTORS FIRST PREFERENCE.
Description
The repository currently contains multiple usages of .unwrap() and .expect() in production code across several modules. While convenient during development, these calls can cause the application to panic unexpectedly when encountering runtime failures such as missing paths, poisoned locks, invalid options, or failed I/O operations.
This impacts the reliability and stability of ClipWallet, especially in user-facing or daemon-related workflows.
Examples
Some notable occurrences include:
Why This Matters
- Unexpected panics can terminate the application abruptly.
- Panics reduce fault tolerance and worsen user experience.
- Robust error propagation improves maintainability and debugging.
- Following idiomatic Rust error handling practices improves overall code quality.
Suggested Improvements
Example Refactor
// Current
fs::create_dir_all(path.parent().unwrap())?;
// Suggested
let parent = path
.parent()
.ok_or_else(|| anyhow!("Invalid plist path"))?;
fs::create_dir_all(parent)?;
Scope
This issue aims to:
- Audit
.unwrap() and .expect() usage across the repository
- Remove avoidable panics in production/runtime code
- Improve error messages and propagation
- Keep
.unwrap() only where invariants are fully guaranteed or within tests
Acceptance Criteria
- Reduce unsafe panic paths caused by
.unwrap()/.expect()
- Ensure meaningful errors are returned/logged instead of crashing
- Pass existing tests and lint checks after refactor
NEW CONTRIBUTORS FIRST PREFERENCE.
Description
The repository currently contains multiple usages of
.unwrap()and.expect()in production code across several modules. While convenient during development, these calls can cause the application to panic unexpectedly when encountering runtime failures such as missing paths, poisoned locks, invalid options, or failed I/O operations.This impacts the reliability and stability of ClipWallet, especially in user-facing or daemon-related workflows.
Examples
Some notable occurrences include:
src/config.rssrc/daemon/plist.rsAdditional
.unwrap()usages are present in:src/main.rssrc/engine.rssrc/daemon/plist.rsRwLock)Why This Matters
Suggested Improvements
Replace unnecessary
.unwrap()and.expect()calls with:?operator for propagating errorsok_or_else(...)map_err(...)Example Refactor
Scope
This issue aims to:
.unwrap()and.expect()usage across the repository.unwrap()only where invariants are fully guaranteed or within testsAcceptance Criteria
.unwrap()/.expect()