Skip to content

Commit 5d9b3b1

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Fix unused variable 'moduleClass' in RCTTurboModuleManager.mm
Summary: Pika 27 (LLVM 21 / Swift 6.4) flags `Class moduleClass = [module class];` as an unused variable (`-Werror,-Wunused-variable`) in `RCTTurboModuleManager.mm`. Its only reference is inside an `RCTLogError` call, which compiles to a no-op in release builds, leaving the variable unused. This inlines `[module class]` directly into the `RCTLogError` call and removes the local declaration. The expression is now elided together with the log macro in release builds, eliminating the dangling unused variable. Debug logging behavior is identical. No `#pragma` diagnostic suppression is used, per the task requirements. [Session trajectory link](https://www.internalfb.com/intern/devai/devmate/inspector/?id=36a6fdd8-65cb-4fd8-bbc5-6d4afa5245dd) Reviewed By: javache Differential Revision: D108605640
1 parent 097dbc2 commit 5d9b3b1

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ - (instancetype)initWithBridgeProxy:(RCTBridgeProxy *)bridgeProxy
333333
* Use respondsToSelector: below to infer conformance to @protocol(RCTTurboModule). Using conformsToProtocol: is
334334
* expensive.
335335
*/
336-
Class moduleClass = [module class];
337336
if ([module respondsToSelector:@selector(getTurboModule:)]) {
338337
ObjCTurboModule::InitParams params = {
339338
.moduleName = moduleName,
@@ -345,7 +344,7 @@ - (instancetype)initWithBridgeProxy:(RCTBridgeProxy *)bridgeProxy
345344

346345
auto turboModule = [(id<RCTTurboModule>)module getTurboModule:params];
347346
if (turboModule == nullptr) {
348-
RCTLogError(@"TurboModule \"%@\"'s getTurboModule: method returned nil.", moduleClass);
347+
RCTLogError(@"TurboModule \"%@\"'s getTurboModule: method returned nil.", [module class]);
349348
}
350349
_turboModuleCache.insert({moduleName, turboModule});
351350

0 commit comments

Comments
 (0)