Unverified Commit f97aa12d authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Fix clippy lints on the orchestrator generated code (#2798)

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent e03c75c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ fun decoratorForBuiltIn(
                            } else {
                                rust("$configRef.$name")
                            }
                            if (parameter.type == ParameterType.STRING) {
                            if (codegenContext.smithyRuntimeMode.defaultToMiddleware && parameter.type == ParameterType.STRING) {
                                rust(".clone()")
                            }
                        }
+10 −3
Original line number Diff line number Diff line
@@ -302,10 +302,12 @@ class ResiliencyReExportCustomization(private val runtimeConfig: RuntimeConfig)
    }
}

class ResiliencyServiceRuntimePluginCustomization : ServiceRuntimePluginCustomization() {
class ResiliencyServiceRuntimePluginCustomization(
    private val codegenContext: ClientCodegenContext,
) : ServiceRuntimePluginCustomization() {
    override fun section(section: ServiceRuntimePluginSection): Writable = writable {
        if (section is ServiceRuntimePluginSection.AdditionalConfig) {
            rust(
            rustTemplate(
                """
                if let Some(sleep_impl) = self.handle.conf.sleep_impl() {
                    ${section.newLayerName}.put(sleep_impl);
@@ -313,8 +315,13 @@ class ResiliencyServiceRuntimePluginCustomization : ServiceRuntimePluginCustomiz
                if let Some(timeout_config) = self.handle.conf.timeout_config() {
                    ${section.newLayerName}.put(timeout_config.clone());
                }
                ${section.newLayerName}.put(self.handle.conf.time_source().clone());
                ${section.newLayerName}.put(self.handle.conf.time_source()#{maybe_clone});
                """,
                "maybe_clone" to writable {
                    if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
                        rust(".clone()")
                    }
                },
            )
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -97,5 +97,5 @@ class RequiredCustomizations : ClientCodegenDecorator {
        codegenContext: ClientCodegenContext,
        baseCustomizations: List<ServiceRuntimePluginCustomization>,
    ): List<ServiceRuntimePluginCustomization> =
        baseCustomizations + listOf(ResiliencyServiceRuntimePluginCustomization())
        baseCustomizations + listOf(ResiliencyServiceRuntimePluginCustomization(codegenContext))
}
+1 −6
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ import software.amazon.smithy.model.node.BooleanNode
import software.amazon.smithy.model.node.Node
import software.amazon.smithy.model.node.StringNode
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.ShapeType
import software.amazon.smithy.model.traits.EndpointTrait
import software.amazon.smithy.rulesengine.language.syntax.parameters.Parameters
import software.amazon.smithy.rulesengine.traits.ContextIndex
@@ -118,11 +117,7 @@ class EndpointParamsInterceptorGenerator(
        idx.getClientContextParams(codegenContext.serviceShape).orNull()?.parameters?.forEach { (name, param) ->
            val paramName = EndpointParamsGenerator.memberName(name)
            val setterName = EndpointParamsGenerator.setterName(name)
            if (param.type == ShapeType.BOOLEAN) {
            rust(".$setterName(_config.$paramName())")
            } else {
                rust(".$setterName(_config.$paramName().clone())")
            }
        }

        idx.getStaticContextParams(operationShape).orNull()?.parameters?.forEach { (name, param) ->
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ open class OperationGenerator(
                                    .unwrap()
                            })
                        };
                        let context = Self::orchestrate_with_stop_point(&runtime_plugins, input, #{StopPoint}::None)
                        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, #{StopPoint}::None)
                            .await
                            .map_err(map_err)?;
                        let output = context.finalize().map_err(map_err)?;
Loading