-
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 <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
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 <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
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 <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: nodejs#41488 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
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 <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: #41488 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
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 <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Remove comparison to null of variable guaranteed to be a boolean.