Skip to content

Allow developers to bind aws_smithy_mocks::RuleBuilder to a variable - #4665

Open
eagletmt wants to merge 3 commits into
smithy-lang:mainfrom
eagletmt:aws-smithy-mocks/avoid-experimental-stmt_expr_attributes
Open

Allow developers to bind aws_smithy_mocks::RuleBuilder to a variable#4665
eagletmt wants to merge 3 commits into
smithy-lang:mainfrom
eagletmt:aws-smithy-mocks/avoid-experimental-stmt_expr_attributes

Conversation

@eagletmt

Copy link
Copy Markdown
Contributor

Motivation and Context

Currently, the following code does not compile because it requires an experimental feature.
rust-lang/rust#15701

let rule_builder = aws_smithy_mocks::mock!(aws_sdk_s3::Client::get_object);

I'd like to allow this style.

Description

We can workaround this issue by surrounding it with braces.

let rule_builder = { aws_smithy_mocks::mock!(aws_sdk_s3::Client::get_object) };

This PR adds the workaround to the aws-smithy-mocks crate.

Testing

I added test cases.

cd rust-runtime/aws-smithy-mocks
cargo test

Checklist

  • 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.

Currently, the following code does not compile because it requires an
experimental feature.
rust-lang/rust#15701

```rust
let rule_builder = aws_smithy_mocks::mock!(aws_sdk_s3::Client::get_object);
```

Developers can workaround this issue by surrounding it with braces.

```rust
let rule_builder = { aws_smithy_mocks::mock!(aws_sdk_s3::Client::get_object) };
```

This PR adds the workaround to the aws-smithy-mocks crate.
@eagletmt
eagletmt requested review from a team as code owners May 13, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants