-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe853b2
commit 3568058
Showing
15 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# must_use | ||
## What it does | ||
Checks that the return values of functions [marked `must_use`](../usage/std.md#must_use) are used. | ||
|
||
## Why this is bad | ||
This lint will only catch uses where the function has no reason to be called other than to use its output. | ||
|
||
|
||
## Example | ||
```lua | ||
bit32.bor(entity.flags, Flags.Invincible) | ||
``` | ||
|
||
...should be written as... | ||
|
||
```lua | ||
entity.flags = bit32.bor(entity.flags, Flags.Invincible) | ||
``` | ||
|
||
...as `bit32.bor` only produces a new value, it does not mutate anything. | ||
|
||
## Remarks | ||
The output is deemed "unused" if the function call is its own statement. |
Oops, something went wrong.