From 3d6044158fc5feb8d6a1422a845a159c0a5bbe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20M=2E=20Gonz=C3=A1lez?= Date: Thu, 24 Jul 2025 15:03:03 -0300 Subject: [PATCH] Added null_effects documentation. --- .../pages/en/build/smart-contracts/linter.mdx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/nextra/pages/en/build/smart-contracts/linter.mdx b/apps/nextra/pages/en/build/smart-contracts/linter.mdx index df7c23eb5..b736d310e 100644 --- a/apps/nextra/pages/en/build/smart-contracts/linter.mdx +++ b/apps/nextra/pages/en/build/smart-contracts/linter.mdx @@ -168,6 +168,30 @@ Check for boolean expressions that can be simplified when a boolean literal (eit Does NOT consider side-effects/short-circuiting in the recommended simplifications. Example: - `1/0 || true` is logically equivalent to `true`, but applying this simplification affects program semantics. +### `null_effects` + +Checks for statements that can be removed without changing program behavior. Examples: +- `42;` +- `*(&mut 0) = /*...*/;` +- `pure_function(21);` + +It also checks for more complex cases, such as +```move +{ + let x = 0; + x += 1; + x +}; +``` +and +```move +{ + let x = 0; + function_that_modifies_its_argument(&mut x); + x +}; +``` + ### `self_assignment` Checks for patterns where a variable or a field of a struct is assigned to itself and suggests removing the assignment. These assignments do not affect the state of the program. Examples include: