You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current auto-generated += and -= implementation is hard to read, and should be replaced with += where possible. That said, we cannot auto-replace it just yet because Rust behaves differently in debug mode, therefore we should use second best approach - a macro that clearly shows intention without all the boilerplate code.
The only manual code are two macros in the src/enc/mod.rs
Use this replacement file as described in other recent PRs to replace boilerplate code.
<details>
<summary>replacement file content</summary>
```diff
@@
expression cond, expr;
@@
if cond
{
- let _rhs = 1;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as u32);
+::wrapping_add!(expr, 1);
}
@@
expression expr;
@@
-{
- let _rhs = 1;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as u32);
+::wrapping_add!(expr, 1);
-}
@@
expression expr;
@@
-{
- let _rhs = 1u32;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs);
+::wrapping_add!(expr, 1);
-}
@@
expression expr;
@@
-{
- let _rhs = 1i32;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as u32);
+::wrapping_add!(expr, 1);
-}
@@
expression expr;
@@
-{
- let _rhs = 1;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as usize);
+::wrapping_add!(expr, 1);
-}
@@
expression inc, expr;
@@
-{
- let _rhs = inc;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as u32);
+::wrapping_add!(expr, inc as u32);
-}
@@
expression inc, expr;
@@
-{
- let _rhs = inc;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs);
+::wrapping_add!(expr, inc);
-}
@@
expression inc, expr;
@@
-{
- let _rhs = inc;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as u32);
+::wrapping_add!(expr, inc as u32);
-}
@@
expression inc, expr;
@@
-{
- let _rhs = inc;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_add(_rhs as usize);
+::wrapping_add!(expr, inc as usize);
-}
@@
expression expr;
@@
-{
- let _rhs = 1;
- let _lhs = &mut expr;
- *_lhs = (*_lhs).wrapping_sub(_rhs as usize);
+::wrapping_sub!(expr, 1);
-}
```
</details>
0 commit comments