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

The protocol `ServerServiceGenerator` hosts is already typed as a
`ServerProtocol`.
This commit is contained in:
david-perez 2022-10-03 18:19:56 +02:00 committed by GitHub
parent 7fb7e177d0
commit 39c0096c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -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)
}

View File

@ -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))