unused_result
Finds a call to a @UseResult procedure, as a statement.
Category suspicious, warn by default.
#import "Basic";
#import "String";
main :: () {
line := " hello ";
trim(line);
print("[%]\n", line);
}warning[unused_result]: the result of `trim` is discarded; it does not change its arguments
--> example.jai:7:5
|
7 | trim(line);
| ^^^^^^^^^^
|
help: to update the argument, write `line = trim(line);`
|
7 ~ line = trim(line);
|
= note: `unused_result` is `warn` by default#import "Basic";
#import "String";
main :: () {
line := " hello ";
line = trim(line);
print("[%]\n", line);
}Procedures declared with @UseResult (many in Basic/String/Math), so a program's own trim is left alone unless it carries the note.