-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
stream: remove always-false condition check #41488
Conversation
Remove comparison to null of variable guaranteed to be a boolean.
Review requested:
|
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
@@ -119,14 +119,14 @@ function isReadableFinished(stream, strict) { | |||
function isReadable(stream) { | |||
if (stream && stream[kIsReadable] != null) return stream[kIsReadable]; | |||
const r = isReadableNodeStream(stream); |
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.
r
value is unused if typeof stream?.readable
is not a boolean, it would be worth move its assignment below. (Same in isWritable
)
This comment has been minimized.
This comment has been minimized.
Landed in f7be6ab |
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: nodejs#41488 (review)
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: #41488 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: #41488 (review) PR-URL: #41534 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: nodejs#41488 (review) PR-URL: nodejs#41534 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: #41488 (review) PR-URL: #41534 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: nodejs#41488 (review) PR-URL: nodejs#41534 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: #41488 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Instead of assigning a boolean, move the function call that assigns a value to the boolean to the only place that boolean is checked. This avoids the function call in cases where it is not needed. Refs: #41488 (review) PR-URL: #41534 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Remove comparison to null of variable guaranteed to be a boolean.