-
Notifications
You must be signed in to change notification settings - Fork 2.2k
maint(Clang-Tidy): readability-const-return #3254
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
iterator make_key_iterator(Iterator first, Sentinel last, Extra &&... extra) { | ||
iterator make_key_iterator(Iterator first, Sentinel last, Extra &&...extra) { |
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.
Intentional?
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.
Clang-Format. I can revert.
@@ -244,6 +245,7 @@ TEST_SUBMODULE(eigen, m) { | |||
|
|||
// test_fixed, and various other tests | |||
m.def("fixed_r", [mat]() -> FixedMatrixR { return FixedMatrixR(mat); }); | |||
// NOLINTNEXTLINE(readability-const-return-type) | |||
m.def("fixed_r_const", [mat]() -> const FixedMatrixR { return FixedMatrixR(mat); }); |
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.
This used to return a non-writable numpy array, now it returns a writable one.
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.
Unchanged files with check annotations (Beta) - very nice to see!
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.
How annoyingly offspec, Fixing this.
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.
It's a kind-of-handy and "cute" trick, but not at all "normal" C++!
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.
Is that trick explained somewhere? (I still don't know what it is.) A one-line comment here with a hint would be nice.
@@ -244,6 +245,7 @@ TEST_SUBMODULE(eigen, m) { | |||
|
|||
// test_fixed, and various other tests | |||
m.def("fixed_r", [mat]() -> FixedMatrixR { return FixedMatrixR(mat); }); | |||
// NOLINTNEXTLINE(readability-const-return-type) | |||
m.def("fixed_r_const", [mat]() -> const FixedMatrixR { return FixedMatrixR(mat); }); |
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.
Is that trick explained somewhere? (I still don't know what it is.) A one-line comment here with a hint would be nice.
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 for the Eigen comment! That makes it totally clear.
I'll merge this now, to then merge into to smart_holder branch, cleanup there, and then run the Google global testing overnight. |
Oh darn, I didn't merge this yes because there was a useless a NOLINT I hadn't got around to deleting. |
Oops, sorry. Is that a one-line delete? Where? I could test it via the smart_holder testing, we could simply push directly to master. |
cast.h 1187 |
Thanks! I still have everything open (local clang-tidy testing). I'll take care of it. |
I'm running into a snag with my grand overnight testing plan. See below.
|
Never mind, a quick guess worked: the proto_utils.cc code needs to be changed to |
I actually managed to run the Google global testing overnight. There is a pretty high number of failures (hundreds), with estimated 9 root causes. Unfortunately I cannot share the full list publicly, but one root cause points to pytorch. I'll work on this asap and will log my updates here. |
…sts reflective of user code that breaks when those `const` are removed.
* Restoring `const` removed from pytypes.h in PR #3254, adding tests reflective of user code that breaks when those `const` are removed. * clang-tidy NOLINTs (and one collateral fix). * Inserting PYBIND11_CONST_FOR_STRICT_PLATFORMS * Trying `defined(__APPLE__)` * Trying again: `auto it` for strict platforms. * Adding NOLINTNEXTLINE(bugprone-macro-parentheses), expanding comments. * Labeling all changes with `PR #3263`, for easy reference, and to make it easy to undo these changes if we decide to do so in the future.
Description
Suggested changelog entry: