refactor: Add [[nodiscard]] where ignoring a Result return type is an error#27774
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
How did you select these? |
I asked my brain if it thought that ignoring the return type would lead to errors in later code. |
stickies-v
left a comment
There was a problem hiding this comment.
ACK fa5680b
I looked at all sites where Result is either of type void or some other descriptive/status type, and could not find any other places where the return value can never be ignored.
…ult return type is an error fa5680b fix includes for touched header files (iwyu) (MarcoFalke) dddde27 Add [[nodiscard]] where ignoring a Result return type is an error (MarcoFalke) Pull request description: Only add it for those where it is an error to ignore. Also, fix the gcc compile warning bitcoin#25977 (comment). Also, fix iwyu for touched header files. ACKs for top commit: TheCharlatan: ACK fa5680b stickies-v: ACK fa5680b Tree-SHA512: c3509103bfeae246e2cf565bc561fcd68d8118515bac5431ba5304c3a63c8254b9c4f40e268b6f6d6b79405675c5a960db9b4eb3bdd14aedca333dc1c9e76415
Summary: > refactor: Replace std::optional<bilingual_str> with util::Result bitcoin/bitcoin@8aa8f73 > Add [[nodiscard]] where ignoring a Result return type is an error bitcoin/bitcoin@dddde27 > fix includes for touched header files (iwyu) bitcoin/bitcoin@fa5680b This is a partial backport of [[bitcoin/bitcoin#25977 | core#25977]] and [[bitcoin/bitcoin#27774 | core#27774]] Test Plan: `ninja all check-all` `grep -r 'std::optional<bilingual_str>' src/` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D14992
Only add it for those where it is an error to ignore. Also, fix the gcc compile warning #25977 (comment). Also, fix iwyu for touched header files.