-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update Rust version * wip * Refactor handling of clippy lints * Delete old version of clippy lints * Delete unused code
- Loading branch information
Showing
20 changed files
with
121 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ on: [push] | |
name: CI | ||
|
||
env: | ||
rust_version: 1.50.0 | ||
rust_version: 1.51.0 | ||
java_version: 14 | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...in/software/amazon/smithy/rust/codegen/smithy/customizations/AllowClippyLintsGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.smithy.customizations | ||
|
||
import software.amazon.smithy.rust.codegen.rustlang.Attribute | ||
import software.amazon.smithy.rust.codegen.rustlang.writable | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsSection | ||
|
||
val ClippyAllowLints = listOf( | ||
// Sometimes a operation be named the same as our module eg. output leading to `output::output` | ||
"module_inception", | ||
// Currently, we don't recase acronyms in models, eg. SSEVersion | ||
"upper_case_acronyms", | ||
// Large errors trigger this warning, we are unlikely to optimize this case currently | ||
"large_enum_variant" | ||
) | ||
|
||
class AllowClippyLints() : LibRsCustomization() { | ||
override fun section(section: LibRsSection) = when (section) { | ||
is LibRsSection.Attributes -> writable { | ||
ClippyAllowLints.forEach { | ||
Attribute.Custom("allow(clippy::$it)", container = true).render(this) | ||
} | ||
// add a newline at the end | ||
this.write("") | ||
} | ||
else -> emptySection | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...rc/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/BaseCustomizations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.smithy.customize | ||
|
||
import software.amazon.smithy.rust.codegen.smithy.customizations.AllowClippyLints | ||
import software.amazon.smithy.rust.codegen.smithy.customizations.CrateVersionGenerator | ||
import software.amazon.smithy.rust.codegen.smithy.customizations.SmithyTypesPubUseGenerator | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization | ||
import software.amazon.smithy.rust.codegen.smithy.generators.ProtocolConfig | ||
|
||
/** A set of customizations that are included in all protocols. | ||
* | ||
* This exists as a convenient place to gather these modifications, these are not true customizations. | ||
*/ | ||
class BaseCustomizations : RustCodegenDecorator { | ||
override val name: String = "Base" | ||
override val order: Byte = -1 | ||
|
||
override fun libRsCustomizations( | ||
protocolConfig: ProtocolConfig, | ||
baseCustomizations: List<LibRsCustomization> | ||
): List<LibRsCustomization> { | ||
return baseCustomizations + CrateVersionGenerator() + SmithyTypesPubUseGenerator(protocolConfig.runtimeConfig) + AllowClippyLints() | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters