codegen: skip rustfmt for generated mod.rs - #335
Merged
Merged
Conversation
Add a file-level rustfmt skip attribute below the generated marker when creating or updating mod.rs. Preserve existing declarations, comments, and attributes without duplicating the generated header. Cover fresh indexes and indexes previously written by rust-protobuf. Signed-off-by: Tim Zhang <tim@hyper.sh>
Tim-Zhang
force-pushed
the
fix/generated-module-order
branch
from
September 30, 2026 08:36
41a9c0d to
89f7248
Compare
Tim-Zhang
force-pushed
the
fix/generated-module-order
branch
from
September 30, 2026 08:39
89f7248 to
5cbbd68
Compare
Remove the generated sync and async module indexes from version control. Keep the handwritten protocol entry point tracked and ignore regenerated indexes alongside the other generated bindings. Signed-off-by: Tim Zhang <tim@hyper.sh>
Tim-Zhang
force-pushed
the
fix/generated-module-order
branch
from
September 30, 2026 08:44
5cbbd68 to
c51a97b
Compare
teawater
approved these changes
Sep 30, 2026
lifupan
approved these changes
Sep 30, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated
mod.rsfiles append ttrpc service modules after rust-protobuf message modules, causing downstreamcargo fmt --checkto fail on their combined ordering. Add a file-level rustfmt skip attribute below the first-line// @generatedmarker. Repeated generation preserves existing declarations, comments, and attributes without duplicating the header.Stop tracking the example's generated sync and async
mod.rsfiles and ignore regenerated indexes. Keep the handwritten protocol entry point tracked, with its existing rustfmt skip attributes so formatting also works before generation.Validation: a fresh
cargo check --offline -p ttrpc-example --examplespassed and regenerated both ignored indexes.cargo fmt --all -- --checkpassed before and after generation. Runtime/integration tests were not rerun for this cleanup.