Unverified Commit 39c0096c authored by david-perez's avatar david-perez Committed by GitHub
Browse files

Remove unnecessary call to upgrade to a server protocol for `ServerServiceGeneratorV2` (#1805)

The protocol `ServerServiceGenerator` hosts is already typed as a
`ServerProtocol`.
parent 7fb7e177
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -89,10 +89,9 @@ open class ServerServiceGenerator(
        rustCrate.withModule(
            RustModule("service", RustMetadata(visibility = Visibility.PUBLIC, additionalAttributes = listOf(Attribute.DocHidden)), null),
        ) { writer ->
            val serverProtocol = ServerProtocol.fromCoreProtocol(protocol)
            ServerServiceGeneratorV2(
                codegenContext,
                serverProtocol,
                protocol,
            ).render(writer)
        }

+1 −2
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ package software.amazon.smithy.rust.codegen.server.smithy.protocols
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport
import software.amazon.smithy.rust.codegen.core.smithy.protocols.Protocol
import software.amazon.smithy.rust.codegen.core.smithy.protocols.ProtocolGeneratorFactory
import software.amazon.smithy.rust.codegen.core.smithy.protocols.RestJson
import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenContext
import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerRestJsonProtocol

@@ -17,7 +16,7 @@ import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.Ser
 * with RestJson1 specific configurations.
 */
class ServerRestJsonFactory : ProtocolGeneratorFactory<ServerHttpBoundProtocolGenerator, ServerCodegenContext> {
    override fun protocol(codegenContext: ServerCodegenContext): Protocol = RestJson(codegenContext)
    override fun protocol(codegenContext: ServerCodegenContext): Protocol = ServerRestJsonProtocol(codegenContext)

    override fun buildProtocolGenerator(codegenContext: ServerCodegenContext): ServerHttpBoundProtocolGenerator =
        ServerHttpBoundProtocolGenerator(codegenContext, ServerRestJsonProtocol(codegenContext))