-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Codestyle: Don't use auto where not warranted #81414
Codestyle: Don't use auto where not warranted #81414
Conversation
tests/scene/test_arraymesh.h
Outdated
@@ -195,7 +195,7 @@ TEST_CASE("[SceneTree][ArrayMesh] Surface metadata tests.") { | |||
} | |||
|
|||
SUBCASE("Returns correct format for the mesh") { | |||
auto format = RS::ARRAY_FORMAT_BLEND_SHAPE_MASK | RS::ARRAY_FORMAT_TEX_UV | RS::ARRAY_FORMAT_INDEX; | |||
RS::ArrayFormat format = RS::ARRAY_FORMAT_BLEND_SHAPE_MASK | RS::ARRAY_FORMAT_TEX_UV | RS::ARRAY_FORMAT_INDEX; |
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.
Example of why auto
isn't good when the type should be clear...
invalid conversion from 'int' to 'RenderingServer::ArrayFormat' [-fpermissive]
eabb977
to
7d6bb4c
Compare
What about: godot/modules/openxr/scene/openxr_hand.cpp Lines 216 to 217 in d6d8cb1
|
I missed those, my regex was |
Also: godot/modules/openxr/openxr_api.cpp Line 304 in d6d8cb1
That one would be Otherwise I can't find any myself |
We allow using auto for lambdas or complex macros where a return type may change based on the parameters. But where the type is clear, we should be explicit. Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
7d6bb4c
to
1151866
Compare
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.
LGTM 🎉
@@ -2077,7 +2076,7 @@ XRPose::TrackingConfidence _transform_from_location(const T &p_location, Transfo | |||
Basis basis; | |||
Vector3 origin; | |||
XRPose::TrackingConfidence confidence = XRPose::XR_TRACKING_CONFIDENCE_NONE; | |||
const auto &pose = p_location.pose; | |||
const XrPosef &pose = p_location.pose; |
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.
I had to look up what types T
can take, where it's defined in openxr.h
, to know which type its pose
member uses. This really should be explicit for the reader.
We allow using auto for lambdas or complex macros where a return type may change based on the parameters. But where the type is clear, we should be explicit.
https://www.youtube.com/watch?v=z87g8IQTVjw