Commit d4c11dd
Try different protocols against union in question (#4333)
## Motivation and Context
Addresses unused variable warnings identified in #4306. While #4306 fixed XmlBindingTraitSerializerGenerator, it noted that QuerySerializerGenerator contained the same bug when handling union variants with empty structs.
This PR completes the fix for RestXml and AwsQuery protocols. The issue was discovered in S3Control's ObjectEncryptionFilter where builds with -D warnings were failing.
## Description
Modified `QuerySerializerGenerator` to prefix unused variables with
underscore for empty struct variants:
- Added `isEmptyStruct()` to detect empty structures
- Use `_inner` for empty structs, `inner` for non-empty structs
- No changes to JsonSerializerGenerator or CborSerializerGenerator (as these are not affected)
## Testing
Added tests for RestXml, AwsQuery, and RestJson (documents immunity)
Tests enforce `-D warnings` via `clientIntegrationTest`
Verified S3Control compiles cleanly with `RUSTFLAGS="-D warnings"`
<!---## Checklist
If a checkbox below is not applicable, then please DELETE it rather than
leaving it unchecked -->
<!---- [ ] [x] For changes to the smithy-rs codegen or runtime crates, I
have created a changelog entry Markdown file in the .changelog
directory, specifying "client," "server," or both in the applies_to
key.-->
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>1 parent a87ffdf commit d4c11dd
File tree
5 files changed
+249
-55
lines changed- codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize
5 files changed
+249
-55
lines changedLines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
37 | 72 | | |
38 | 73 | | |
39 | 74 | | |
40 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
41 | 83 | | |
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
42 | 79 | | |
43 | 80 | | |
44 | 81 | | |
45 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
46 | 92 | | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
86 | 122 | | |
87 | 123 | | |
88 | 124 | | |
89 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
90 | 133 | | |
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
348 | 358 | | |
349 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
350 | 368 | | |
351 | 369 | | |
352 | 370 | | |
353 | 371 | | |
354 | | - | |
| 372 | + | |
355 | 373 | | |
356 | 374 | | |
357 | 375 | | |
358 | 376 | | |
359 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
360 | 382 | | |
361 | 383 | | |
362 | 384 | | |
363 | 385 | | |
364 | | - | |
| 386 | + | |
365 | 387 | | |
366 | 388 | | |
367 | 389 | | |
368 | 390 | | |
369 | | - | |
370 | | - | |
| 391 | + | |
| 392 | + | |
371 | 393 | | |
372 | 394 | | |
373 | 395 | | |
| |||
0 commit comments