Skip to content
Unverified Commit 2011da48 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

Fix `#[warn(dead_code)]` in the SDK crate for a service with no operations defined (#3012)

## Motivation and Context
When a service has no operations, the following places in a generated
SDK issue `dead_code` warnings:
```
error: field `runtime_plugins` is never read
 --> src/client.rs:5:16
  |
3 | pub(crate) struct Handle {
  |                   ------ field in this struct
4 |     pub(crate) conf: crate::Config,
5 |     pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
  |                ^^^^^^^^^^^^^^^
  |
  = note: `Handle` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  = note: `-D dead-code` implied by `-D warnings`

error: associated function `new` is never used
  --> src/client/customize.rs:30:23
   |
28 |     impl<T, E, B> CustomizableOperation<T, E, B> {
   |     -------------------------------------------- associated function in this implementation
29 |         /// Creates a new `CustomizableOperation` from `customizable_send`.
30 |         pub(crate) fn new(customizable_send: B) -> Self {
   |                       ^^^

error: associated function `new` is never used
   --> src/config.rs:853:19
    |
852 | impl ConfigOverrideRuntimePlugin {
    | -------------------------------- associated function in this implementation
853 |     pub(crate) fn new(
    |                   ^^^
```
This PR adds `#[allow(dead_code)]` to the code generator at the
corresponding places to suppress those warnings.

## Testing
- Added a new unit test to ensure that the warnings are not issued for a
service with no operations.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent 8a1f09ef
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment