Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify non-wrapping += and *= #160

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Mar 17, 2024

Use this replacement file as described in other recent PRs to replace boilerplate code.

Followed by cargo fmt --all
Some of these changes were in #158, but removed now.

replacement file content
@@
expression expr_r, expr_l;
@@
-{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs *= _rhs;
+expr_l *= expr_r;
-}

@@
expression expr_r, expr_l, i, start, end;
@@
for i in start..end
{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs += _rhs;
+expr_l += expr_r;
}

@@
expression expr_r, expr_l;
@@
-{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs += _rhs;
+expr_l += expr_r;
-}

Use this replacement file as described in other recent PRs to replace boilerplate code.

Followed by `cargo fmt --all`

<details>
<summary>replacement file content</summary>

```diff
@@
expression expr_r, expr_l;
@@
-{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs *= _rhs;
+expr_l *= expr_r;
-}

@@
expression expr_r, expr_l, i, start, end;
@@
for i in start..end
{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs += _rhs;
+expr_l += expr_r;
}

@@
expression expr_r, expr_l;
@@
-{
-   let _rhs = expr_r;
-   let _lhs = &mut expr_l;
-   *_lhs += _rhs;
+expr_l += expr_r;
-}
```

</details>
@danielrh
Copy link
Collaborator

lgtm

@danielrh danielrh merged commit 3e526c4 into dropbox:master Mar 20, 2024
2 checks passed
@nyurik nyurik deleted the simplify-non-wrap branch March 20, 2024 03:10
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