fix: server feature → tokio/macros, source mod.rs allow list from buffa ALLOW_LINTS#97
Merged
fix: server feature → tokio/macros, source mod.rs allow list from buffa ALLOW_LINTS#97
Conversation
`Server::serve` uses `tokio::select!` to race accept against graceful
shutdown. The `server` feature enabled `tokio/net` but not
`tokio/macros`, so a crate depending on
`connectrpc = { features = ["server"] }` only compiled when something
else in its closure enabled the feature for it. Our conformance suite
and examples always do — `tokio = { features = ["macros", ...] }` is
in the dev-dependency table — which kept the gap hidden in CI.
…ffa_codegen::ALLOW_LINTS The `pub mod <pkg>` tree wraps buffa's per-proto content (Owned, View, Oneof, Ext, PackageMod stitcher) plus our `__connect.rs` companions. The per-proto content has no `#[allow(...)]` of its own — buffa's `package_mod_allow_attr()` is scoped to `__buffa` and `protoc-gen-buffa-packaging` covers everything else with an inner `#![allow(...)]` that has no analogue in connectrpc-build's outer-mod layout — so the suppression set must be the union of `buffa_codegen::ALLOW_LINTS` and the lints connect-rust output trips. The hardcoded list had drifted: it was missing `clippy::uninlined_format_args` (which buffa enum JSON deserialize errors trip), `clippy::doc_lazy_continuation`, and `clippy::module_inception`. Sourcing from `ALLOW_LINTS` keeps the two in lockstep when buffa adds entries; `impl_trait_redundant_captures` remains a connectrpc-build-specific addition.
Regenerate the checked-in conformance/example/bench output against the buffa 0.5.2 protoc plugins. The visible diff: oneof JSON serde match arms now use `Self::Variant`, enum JSON deserialize errors use inlined format args, and the per-package `#[allow(...)]` blocks gain `unused_qualifications` (from buffa 0.5.1's ALLOW_LINTS change).
|
All contributors have signed the CLA ✍️ ✅ |
# Conflicts: # connectrpc/Cargo.toml
iainmcgin
added a commit
to anthropics/buffa
that referenced
this pull request
May 8, 2026
…n enum serde (#104) Two `buffa-codegen` fixes for opt-in clippy lints that the v0.5.0 per-proto split layout exposed, plus the 0.5.2 version bump. ## `clippy::use_self` in oneof JSON serde (`ab92334e`) `generate_oneof_serialize` emits the manual `impl Serialize for #enum_ident { fn serialize(&self, …) { match self { … } } }` with match arms spelled `#enum_ident::#variant`. `Self` resolves to the oneof enum there, so the qualified form trips `clippy::use_self`. Switched to `Self::#variant` with a comment explaining why the deserialize arms in `oneof_variant_deser_arm` are deliberately left qualified — those construct the oneof from inside the *message*'s `Deserialize` impl, where `Self` is the message type, not the oneof. ## `clippy::uninlined_format_args` in enum JSON deserialize errors (`578164cc`) The enum visitor's range-check and unknown-value error messages used positional `format!("enum value {} out of i32 range", v)`. Switched to `format!("enum value {v} out of i32 range")`. Semantically identical. ## Why these escape `ALLOW_LINTS` Both lints fire in the *per-proto Owned content* (`<dotted.proto>.rs`, `<dotted.proto>.__oneof.rs`), which is `include!`'d at the *package* level — outside the `pub mod __buffa { … }` block where `package_mod_allow_attr()` puts the `#[allow(...)]`. `protoc-gen-buffa-packaging` consumers get covered by the `mod.rs` inner `#![allow(...)]`, but `connectrpc-build` consumers wrap the package tree with an *outer* `#[allow(...)]` whose contents drift independently (see the matching connect-rust 0.4.2 PR, anthropics/connect-rust#97). The cleanest fix is to make the codegen lint-clean regardless of the wrapper. ## Verification - `cargo test -p buffa-codegen --lib`: 327 passed - `cargo test -p buffa-test --lib`: 292 passed - `cargo clippy -p buffa-codegen --lib -- -D warnings`: clean - `task gen-wkt-types` / `task gen-bootstrap-types` produce no diff (the WKT/descriptor protos don't have JSON-serde oneofs or enums), so `check-generated-code` should be unaffected. - Validated end-to-end against a downstream workspace via `[patch.crates-io]` — `cargo clippy --workspace --all-targets -- -D warnings` clean across ~150 buffa-consuming crates.
rpb-ant
approved these changes
May 8, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A codegen lint fix plus a regen for the v0.4.2 patch release.
(Independently found the missing
tokio/macroson theserverfeature on the8f0180bcommit; #80 landed the same fix in the meantime, so the merge resolves to that. This PR adds the CHANGELOG entries for #80'sserve_tlshelper andtokio/macrosfix, which were missed when it landed.)connectrpc-build: source the generatedmod.rs#[allow(...)]frombuffa_codegen::ALLOW_LINTS(2b6d090)The hardcoded list had drifted behind buffa's: it was missing
clippy::uninlined_format_args(which buffa enum JSON deserialize errors trip),clippy::doc_lazy_continuation, andclippy::module_inception.The
pub mod <pkg>tree wraps buffa's per-proto split output (Owned/View/Oneof/Ext + the PackageMod stitcher) plus our__connect.rscompanions. The per-proto Owned content has no#[allow(...)]of its own — buffa'spackage_mod_allow_attr()is scoped to__buffa, andprotoc-gen-buffa-packagingcovers everything else with an inner#![allow(...)]that has no analogue inconnectrpc-build's outer-mod layout. So the suppression set must be the union ofbuffa_codegen::ALLOW_LINTSand the lints connect-rust output trips. Sourcing fromALLOW_LINTSkeeps the two from drifting again. Bumps thebuffa-codegendependency floor to0.5.1(unused_qualificationslanded inALLOW_LINTSthere).Regen + version bump (
17dad20)Regenerates the checked-in conformance/example/bench output against the buffa 0.5.2 toolchain (
Self::in oneof serde, inlined format args in enum serde — see anthropics/buffa#104). Bumps to 0.4.2.Verification
cargo test -p connectrpc -p connectrpc-build -p connectrpc-codegen --lib: 252 + 18 + 35 passedcargo build -p eliza-example -p multiservice-example -p connectrpc-conformance -p rpc-bench: cleancargo clippy -p connectrpc-conformance -p eliza-example -p connectrpc -p connectrpc-build --lib -- -D warnings: cleancargo build -p connectrpc --features serverin isolation: now compiles (was failing without thetokio/macrosfix)[patch.crates-io]—cargo clippy --workspace --all-targets -- -D warningsclean across ~150 connectrpc-consuming crates with the matching buffa 0.5.2.Release order: anthropics/buffa#104 → buffa v0.5.2 should ship first; the regen here was produced against that toolchain.