diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt index f7c68c6583a67ed61df23d009ddaf0412d3d64ae..4a7e6cae11be32e6d284dfd83895e8f004b8ec73 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt @@ -69,7 +69,6 @@ class CodegenVisitor( SymbolVisitorConfig( runtimeConfig = settings.runtimeConfig, renameExceptions = settings.codegenConfig.renameExceptions, - handleRustBoxing = true, nullabilityCheckMode = NullableIndex.CheckMode.CLIENT_ZERO_VALUE_V1, ) val baseModel = baselineTransform(context.model) diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt index 3b2024faed778fb9fdb202e708757dff17f6b773..d72bafb5b977c49586438d2452a0bb08e9ce133e 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt @@ -65,7 +65,6 @@ val SimpleShapes: Map, RustType> = mapOf( data class SymbolVisitorConfig( val runtimeConfig: RuntimeConfig, val renameExceptions: Boolean, - val handleRustBoxing: Boolean, val nullabilityCheckMode: NullableIndex.CheckMode, ) @@ -328,13 +327,8 @@ open class SymbolVisitor( override fun memberShape(shape: MemberShape): Symbol { val target = model.expectShape(shape.target) - val targetSymbol = this.toSymbol(target) // Handle boxing first so we end up with Option>, not Box> - return targetSymbol.letIf(config.handleRustBoxing) { - handleRustBoxing(it, shape) - }.let { - handleOptionality(it, shape) - } + return handleOptionality(handleRustBoxing(toSymbol(target), shape), shape) } override fun timestampShape(shape: TimestampShape?): Symbol { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt index f216f236d47a6af966ead332692c5707a8d418ba..96f508c5d036ab49078ea30e01d8c4d27acf9b8c 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt @@ -152,7 +152,7 @@ open class StructureGenerator( writer.renderMemberDoc(member, memberSymbol) writer.deprecatedShape(member) memberSymbol.expectRustMetadata().render(writer) - writer.write("$memberName: #T,", symbolProvider.toSymbol(member)) + writer.write("$memberName: #T,", memberSymbol) } open fun renderStructure() { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt index 42d37b6679e70afc0b1c665985ea95ab3fc2073f..848762ff183d51d0d6bbb7e9975b46419b4e0af5 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt @@ -39,7 +39,6 @@ val TestRuntimeConfig = val TestSymbolVisitorConfig = SymbolVisitorConfig( runtimeConfig = TestRuntimeConfig, renameExceptions = true, - handleRustBoxing = true, nullabilityCheckMode = NullableIndex.CheckMode.CLIENT_ZERO_VALUE_V1, ) diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt index c4e07d60d917694ef42a96cca24f92a56e59c8a5..0edc5a0878c666a7421af2c5ad087430f5771e2a 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt @@ -48,7 +48,6 @@ class PythonServerCodegenVisitor( SymbolVisitorConfig( runtimeConfig = settings.runtimeConfig, renameExceptions = false, - handleRustBoxing = true, nullabilityCheckMode = NullableIndex.CheckMode.SERVER, ) val baseModel = baselineTransform(context.model) diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt index db93c5cfffebd4df77ab5047eabea0996fa22039..712d930b424e2395511681ddd2e76aba8388673c 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt @@ -75,7 +75,6 @@ open class ServerCodegenVisitor( SymbolVisitorConfig( runtimeConfig = settings.runtimeConfig, renameExceptions = false, - handleRustBoxing = true, nullabilityCheckMode = NullableIndex.CheckMode.SERVER, ) val baseModel = baselineTransform(context.model) diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt index 5c648e6fe4738879cb2f143f0cb82f4060c61512..4159e732c79e5c2efb0c8ee05be7fb0918f9cc14 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt @@ -24,7 +24,6 @@ import software.amazon.smithy.rust.codegen.server.smithy.ServerRustSettings val ServerTestSymbolVisitorConfig = SymbolVisitorConfig( runtimeConfig = TestRuntimeConfig, renameExceptions = false, - handleRustBoxing = true, nullabilityCheckMode = NullableIndex.CheckMode.SERVER, )