Skip to content

Commit

Permalink
[Rust] Generate imports in alphabetical order.
Browse files Browse the repository at this point in the history
  • Loading branch information
gierlachg authored and ZachBray committed Aug 21, 2024
1 parent a5e12d1 commit 7ce24c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void generate() throws IOException
.filter((fileName) -> fileName.endsWith(".rs"))
.filter((fileName) -> !fileName.equals("lib.rs"))
.map((fileName) -> fileName.substring(0, fileName.length() - 3))
.sorted()
.forEach(modules::add);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void generate() throws IOException
try (Writer out = outputManager.createOutput(codecModName))
{
indent(out, 0, "use crate::*;\n\n");
indent(out, 0, "pub use encoder::%sEncoder;\n", formatStructName(msgToken.name()));
indent(out, 0, "pub use decoder::%sDecoder;\n\n", formatStructName(msgToken.name()));
indent(out, 0, "pub use decoder::%sDecoder;\n", formatStructName(msgToken.name()));
indent(out, 0, "pub use encoder::%sEncoder;\n\n", formatStructName(msgToken.name()));
final String blockLengthType = blockLengthType();
final String templateIdType = rustTypeName(ir.headerStructure().templateIdType());
final String schemaIdType = rustTypeName(ir.headerStructure().schemaIdType());
Expand Down

0 comments on commit 7ce24c3

Please sign in to comment.