Skip to content

Commit 5a554fe

Browse files
import serde on all files
1 parent d7baaa9 commit 5a554fe

File tree

1 file changed

+2
-3
lines changed
  • codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang

1 file changed

+2
-3
lines changed

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustWriter.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,7 @@ class RustWriter private constructor(
454454
fun forModule(module: String?): RustWriter = if (module == null) {
455455
RustWriter("lib.rs", "crate")
456456
} else {
457-
var writer = RustWriter("$module.rs", "crate::$module")
458-
RenderSerdeAttribute.importSerde(writer)
459-
writer
457+
RustWriter("$module.rs", "crate::$module")
460458
}
461459

462460
fun factory(debugMode: Boolean): Factory<RustWriter> = Factory { fileName: String, namespace: String ->
@@ -517,6 +515,7 @@ class RustWriter private constructor(
517515
init {
518516
expressionStart = '#'
519517
if (filename.endsWith(".rs")) {
518+
RenderSerdeAttribute.importSerde(this)
520519
require(namespace.startsWith("crate") || filename.startsWith("tests/")) {
521520
"We can only write into files in the crate (got $namespace)"
522521
}

0 commit comments

Comments
 (0)