From 927fe303ad62c82169de568c48f65ce13460b3f3 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Wed, 16 Nov 2022 16:40:44 -0600 Subject: [PATCH] formatting: run code cleanup on entire project (#1993) * formatting: run code cleanup on entire project * revert: deletion of SdkSettings.defaultsConfigPath --- .../amazon/smithy/rustsdk/AwsReadmeDecorator.kt | 2 +- .../software/amazon/smithy/rustsdk/SdkSettings.kt | 15 +++++++++------ .../customize/glacier/AccountIdAutofill.kt | 2 +- .../generators/protocol/ProtocolTestGenerator.kt | 4 ++-- .../rust/codegen/core/smithy/SymbolVisitor.kt | 2 +- .../HttpBoundProtocolPayloadGenerator.kt | 2 +- .../generators/PythonServerModuleGenerator.kt | 2 +- .../ShapeReachableFromOperationInputTagTrait.kt | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt index 666fc342e1..15767c0c1c 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt @@ -218,7 +218,7 @@ internal class AwsSdkReadmeGenerator { private fun Element.normalizeLists() { (getElementsByTag("ul") + getElementsByTag("ol")) // Only operate on lists that are top-level (are not nested within other lists) - .filter { list -> list.parents().none() { it.isList() } } + .filter { list -> list.parents().none { it.isList() } } .forEach { list -> list.normalizeList() } } diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt index bdae9bf35e..7573337891 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt @@ -20,16 +20,19 @@ class SdkSettings private constructor(private val awsSdk: ObjectNode?) { } /** Path to the `sdk-default-configuration.json` config file */ - val defaultsConfigPath: Path? get() = - awsSdk?.getStringMember("defaultConfigPath")?.orNull()?.value.let { Paths.get(it) } + val defaultsConfigPath: Path? + get() = + awsSdk?.getStringMember("defaultConfigPath")?.orNull()?.value.let { Paths.get(it) } /** Path to the `sdk-endpoints.json` configuration */ - val endpointsConfigPath: Path? get() = - awsSdk?.getStringMember("endpointsConfigPath")?.orNull()?.value?.let { Paths.get(it) } + val endpointsConfigPath: Path? + get() = + awsSdk?.getStringMember("endpointsConfigPath")?.orNull()?.value?.let { Paths.get(it) } /** Path to AWS SDK integration tests */ - val integrationTestPath: String get() = - awsSdk?.getStringMember("integrationTestPath")?.orNull()?.value ?: "aws/sdk/integration-tests" + val integrationTestPath: String + get() = + awsSdk?.getStringMember("integrationTestPath")?.orNull()?.value ?: "aws/sdk/integration-tests" /** Version number of the `aws-config` crate */ val awsConfigVersion: String? get() = diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt index a101742512..65e4f3a455 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt @@ -14,7 +14,7 @@ import software.amazon.smithy.rust.codegen.core.smithy.customize.OperationCustom import software.amazon.smithy.rust.codegen.core.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.core.util.inputShape -class AccountIdAutofill() : OperationCustomization() { +class AccountIdAutofill : OperationCustomization() { override fun mutSelf(): Boolean = true override fun consumesSelf(): Boolean = false override fun section(section: OperationSection): Writable { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt index 6f670b641f..f4e3044fa6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt @@ -138,12 +138,12 @@ class ProtocolTestGenerator( testModuleWriter: RustWriter, block: Writable, ) { - testModuleWriter.setNewlinePrefix("/// ") + testModuleWriter.newlinePrefix = "/// " testCase.documentation.map { testModuleWriter.writeWithNoFormatting(it) } testModuleWriter.write("Test ID: ${testCase.id}") - testModuleWriter.setNewlinePrefix("") + testModuleWriter.newlinePrefix = "" TokioTest.render(testModuleWriter) val action = when (testCase) { is HttpResponseTestCase -> Action.Response 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 238a1177bc..1ca4c2ebf2 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 @@ -66,7 +66,7 @@ val SimpleShapes: Map, RustType> = mapOf( data class SymbolVisitorConfig( val runtimeConfig: RuntimeConfig, val renameExceptions: Boolean, - val nullabilityCheckMode: NullableIndex.CheckMode, + val nullabilityCheckMode: CheckMode, ) /** diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt index 69b9b84e0d..5c5cf72f54 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt @@ -193,7 +193,7 @@ class HttpBoundProtocolPayloadGenerator( symbolProvider, unionShape, serializerGenerator, - contentType ?: throw CodegenException("event streams must set a content type"), + contentType, ).render() // TODO(EventStream): [RPC] RPC protocols need to send an initial message with the diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt index 5f2502b408..6bade55562 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt @@ -65,7 +65,7 @@ class PythonServerModuleGenerator( """, *codegenScope, ) - serviceShapes.forEach() { shape -> + serviceShapes.forEach { shape -> val moduleType = moduleType(shape) if (moduleType != null) { rustTemplate( diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ShapeReachableFromOperationInputTagTrait.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ShapeReachableFromOperationInputTagTrait.kt index 64059fac99..14a2f72092 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ShapeReachableFromOperationInputTagTrait.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ShapeReachableFromOperationInputTagTrait.kt @@ -23,7 +23,7 @@ import software.amazon.smithy.rust.codegen.core.util.hasTrait * * See the [ShapesReachableFromOperationInputTagger] model transform for how it's used. */ -class ShapeReachableFromOperationInputTagTrait() : AnnotationTrait(ID, Node.objectNode()) { +class ShapeReachableFromOperationInputTagTrait : AnnotationTrait(ID, Node.objectNode()) { companion object { val ID = ShapeId.from("smithy.api.internal#syntheticStructureReachableFromOperationInputTag") }