-
-
Notifications
You must be signed in to change notification settings - Fork 1
style: adhere to new clippy lint warning #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seems to be related to changes in lint rules for Rust v1.93. See [`unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap) lint rule.
WalkthroughRefactored error handling in the GitHub REST API module by replacing direct unwrap() calls with pattern matching for repository binding and using unwrap_or_default() for SHA retrieval, improving code safety while maintaining existing control flow behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@cpp-linter/src/rest_api/github/mod.rs`:
- Line 133: The code currently uses self.sha.clone().unwrap_or_default(), which
silently supplies an empty SHA and can produce invalid commit URLs; change this
to either assert presence or return an error: replace unwrap_or_default() with
unwrap() or expect("missing SHA for non-PR commit URL") to fail fast when SHA
must exist, or match on self.sha (e.g., if let Some(sha) = &self.sha { ... }
else { return Err(...) }) to explicitly handle the None case; also make the
treatment consistent with the other usage that does self.sha.clone().unwrap() so
both code paths either validate/expect SHA or both defensively return an error.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #255 +/- ##
==========================================
+ Coverage 96.88% 97.04% +0.15%
==========================================
Files 14 14
Lines 3118 3078 -40
==========================================
- Hits 3021 2987 -34
+ Misses 97 91 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Seems to be related to changes in lint rules for Rust v1.93. See
unnecessary_unwraplint rule.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.