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
{{ message }}
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: apps/nextra/pages/en/build/smart-contracts/linter.mdx
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,6 +134,28 @@ Checks for patterns where there are needless references taken when accessing a f
134
134
-`(&s).f` can be simplified to `s.f`
135
135
-`(&mut s).f = 42;` can be simplified to `s.f = 42;`
136
136
137
+
### `nested_if`
138
+
139
+
Checks for nested if statements that can be simplified using the `&&` operator. This lint identifies patterns where an inner if statement with no else branch is contained within an outer if statement that also has no else branch.
140
+
141
+
```move
142
+
if (a) {
143
+
if (b) {
144
+
// some code
145
+
}
146
+
}
147
+
```
148
+
149
+
This pattern can be simplified to:
150
+
151
+
```move
152
+
if (a && b) {
153
+
// some code
154
+
}
155
+
```
156
+
157
+
The simplified version is more readable and avoids unnecessary nesting while maintaining the same logical behavior.
158
+
137
159
### `nonminimal_bool`
138
160
139
161
Check for boolean expressions that can be simplified when a boolean literal (either `true` or `false`) is part of a binary or unary boolean operator. Examples:
0 commit comments