Skip to content
Unverified Commit 24029ab2 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Fix warning for unwrap_or_else in generated builders (#3307)

While attempting to upgrade to Smithy 1.42, I noticed a warning in the
codegen-client integration tests:
```
warning: unnecessary closure used to substitute value for `Option::None`
   --> json_rpc10/rust-client-codegen/src/operation/operation_with_defaults/_operation_with_defaults_output.rs:477:31
    |
477 |             default_int_enum: self.default_int_enum.unwrap_or_else(|| 1),
    |                               ^^^^^^^^^^^^^^^^^^^^^^--------------------
    |                                                     |
    |                                                     help: use `unwrap_or(..)` instead: `unwrap_or(1)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
```

This change fixes these warnings by switching between unwrap_or_else and
unwrap_or based on the shape.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent fe367274
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