-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: Clazy warnings #4988
fix: Clazy warnings #4988
Conversation
Is this actually necessary with auto? I think this is qualifying the auto call? It should be a const ref regardless right, unless I am missing something? We sure this isn't a false positive with clazy? |
Other people suggest |
This saves copy-ctor and dtor for non-trivial types by value Found by clazy (range-loop-reference)
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.
Seems fine to me, even though technically it's probably entirely inconsequential. The explicit const &
make the intent clear without a doubt, and if it silences clazy, it removes a distraction for someone reviewing clazy results.
I forgot to ask: Are there any other clazy warnings? |
Good question! With a minimal set of dependencies I only get two other warnings
Documentation for this warning: https://github.com/KDE/clazy/blob/master/docs/checks/README-non-pod-global-static.md |
Indeed, it would be better to leak those:
Questions:
|
Having this fixed is the right approach. I am unsure how the proper change would look like. 😇
Using clazy is super easy, just install the package and use |
I figured that any code change for the test code would make it less readable and confuse future developers. Thus I explicitly suppressed the second warning. |
Could you please try #4993? Does that fix the clazy warnings for test_smart_ptr.cpp? |
I spent some time looking for a clang-tidy equivalent of clazy's |
I tried your patch, the non-POD warning keeps coming.
Clazy only provides checks that are not part of clang-tidy. A quote from another check: "[The skipped-base-method] check might get removed in the future, as clang-tidy recently got a similar feature." |
Thanks!
Oh ... but it actually makes sense. The Could you please try again: 06475c9 (That's the pattern I usually follow in production code.) |
I forgot to mention: previously I accidentally lost the |
Introduce `pointer_set<T>` boostorg/unordered#139 > Based on the standard, the first move should leave a in a "valid but unspecified state";
This did the trick, the Clazy warnings are gone! I squashed your two commits and added the resulting one to this pull request. |
Merged, thanks! The |
This saves copy-ctor and dtor for non-trivial types by value
Found by clazy (range-loop-reference)
Suggested changelog entry: