Skip to content

Commit aab8df3

Browse files
mdvaccameta-codesync[bot]
authored andcommitted
Fix StringFormatTrivial: Replace String.format with string templates in WebSocketModule (#56114)
Summary: Pull Request resolved: #56114 Fixed StringFormatTrivial lint warnings in WebSocketModule.kt. Replaced trivial String.format calls with Kotlin string templates for better performance. String.format creates a new Formatter instance on each call, while string templates are compiled to simple concatenation. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D96784739 fbshipit-source-id: a6636e9448a3611a9952eb57fff71e4ad174f8c3
1 parent b5b3982 commit aab8df3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/websocket

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ public class WebSocketModule(context: ReactApplicationContext) :
395395

396396
val defaultOrigin =
397397
if (requestURI.port != -1) {
398-
String.format("%s://%s:%s", scheme, requestURI.host, requestURI.port)
398+
"$scheme://${requestURI.host}:${requestURI.port}"
399399
} else {
400-
String.format("%s://%s", scheme, requestURI.host)
400+
"$scheme://${requestURI.host}"
401401
}
402402

403403
return defaultOrigin

0 commit comments

Comments
 (0)