Skip to content

Commit

Permalink
Remove handleRustBoxing config from SymbolVisitor (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti authored Oct 11, 2022
1 parent 057fe97 commit 94a991c
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ val SimpleShapes: Map<KClass<out Shape>, RustType> = mapOf(
data class SymbolVisitorConfig(
val runtimeConfig: RuntimeConfig,
val renameExceptions: Boolean,
val handleRustBoxing: Boolean,
val nullabilityCheckMode: NullableIndex.CheckMode,
)

Expand Down Expand Up @@ -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<Box<_>>, not Box<Option<_>>
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ val TestRuntimeConfig =
val TestSymbolVisitorConfig = SymbolVisitorConfig(
runtimeConfig = TestRuntimeConfig,
renameExceptions = true,
handleRustBoxing = true,
nullabilityCheckMode = NullableIndex.CheckMode.CLIENT_ZERO_VALUE_V1,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class PythonServerCodegenVisitor(
SymbolVisitorConfig(
runtimeConfig = settings.runtimeConfig,
renameExceptions = false,
handleRustBoxing = true,
nullabilityCheckMode = NullableIndex.CheckMode.SERVER,
)
val baseModel = baselineTransform(context.model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ open class ServerCodegenVisitor(
SymbolVisitorConfig(
runtimeConfig = settings.runtimeConfig,
renameExceptions = false,
handleRustBoxing = true,
nullabilityCheckMode = NullableIndex.CheckMode.SERVER,
)
val baseModel = baselineTransform(context.model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

0 comments on commit 94a991c

Please sign in to comment.