chore: Enable clang-tidy bugprone-optional-value-conversion check - #6470
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6470 +/- ##
=========================================
- Coverage 79.8% 79.8% -0.0%
=========================================
Files 862 862
Lines 67875 67875
Branches 7551 7552 +1
=========================================
- Hits 54194 54188 -6
- Misses 13681 13687 +6
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Enables the clang-tidy bugprone-optional-value-conversion check and updates a handful of call/return sites to avoid implicit conversions via dereferenced std::optional values.
Changes:
- Enable
bugprone-optional-value-conversionin.clang-tidy. - Replace
return *opt;/ passing*optwith returning/passing thestd::optionaldirectly in a few locations. - Minor test cleanups to match the new clang-tidy rule.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.clang-tidy |
Enables bugprone-optional-value-conversion (and removes it from the “disabled/problematic checks” comment list). |
src/xrpld/rpc/handlers/Simulate.cpp |
Return the std::optional<Json::Value> error directly instead of converting via *error. |
src/xrpld/rpc/detail/DeliveredAmount.cpp |
Return the std::optional<STAmount> from TxMeta directly instead of converting via *deliveredAmount. |
src/libxrpl/protocol/Permissions.cpp |
Return std::optional<std::string> directly rather than converting from *granular. |
src/test/app/ValidatorList_test.cpp |
Pass std::optional<PublicKey> directly to ValidatorList::load rather than *localSigningPublic. |
src/test/app/PayStrand_test.cpp |
Return existing optionals directly inside helper lambdas (avoids value-to-optional conversion from dereference). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mathbunnyru
left a comment
There was a problem hiding this comment.
nit: I would probably add .has_value() one line above of each statement, but this is already good as is
High Level Overview of Change
This PR enables clang-tidy
bugprone-optional-value-conversioncheck.Context of Change
Type of Change
.gitignore, formatting, dropping support for older tooling)API Impact
No impact.
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)