-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
refactor in DescriptorImpl::{IsSolvable, IsRange} #28747
refactor in DescriptorImpl::{IsSolvable, IsRange} #28747
Conversation
minor refactor commit that replaces some explicit for loops with functionally equivalent but more concise std::algorithms
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process. |
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.
Code looks correct to me, but in general i think we should avoid needless refactorings. Making the code more testable or less footguny for instance would be a good justification for a refactoring. But i don't think modernizing the implementation is one.
(I'm not opposed to merging this though, just pointing out it may not be the best use of everyone's time.)
Not sure. If this is changed, why not use C++20 ranges algorithms, which would be even more concise? However, I wonder what the point is of randomly addressing a single clang-tidy refactor hint in a single source location. If there is any value in a specific clang-tidy check, it should be enabled and changed for all code in one go. If there is little value or not enough value to enable it for all the code and enforce it in CI, then no code should be changed at all, no? |
c++20 is disabled by default, so I don't think it's a good idea to use language/library features from that standard version. Regarding the change itself, it's not coming from a clang-tidy warning or anything, it's just me, surfing the code and noticing a bit of room for improvement. Feel free to reject it if you think it's not worth it. |
Fair enough, I presume it would be surfaced from https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/modernize/loop-convert.html . So I'd say we either use clang-tidy and enforce it, or not do it at all.
I think this change here could wait until C++20 is enabled, see #28349 . There should be no rush to do change anything here (potentially to C++17, and then later again, to C++20) |
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.
Thanks @lightyear15 for taking the time to find ways to improve the code.
I agree with both @darosior and @maflcko, even I like the new style of the proposed change, and I'm not against of having this merged if other reviewers find good reasons to do so, we could wait for std::ranges
on C++ 20 (if we wanted to use that instead) and keep the PR as draft.
I can't convert this to a draft, so I am closing for now. Let us know if you want this reopened after the C++20 switch. |
In the meantime, if you are looking for other good first issues:
|
minor refactor commit that replaces some explicit for loops with functionally equivalent but more concise std::algorithms