When I do
mix compile
I get messages like
warning: variable "test_val" is unused
lib/myapp/mymodule.ex:46
I'm just hacking on a side project and I don't care about these warnings for now. Is there a way to turn this off?
When I do
mix compile
I get messages like
warning: variable "test_val" is unused
lib/myapp/mymodule.ex:46
I'm just hacking on a side project and I don't care about these warnings for now. Is there a way to turn this off?
It doesn't look possible, but I could be wrong.
https://groups.google.com/forum/#!topic/elixir-lang-talk/XBnap4u6OkM
https://elixirforum.com/t/is-there-a-way-to-suppress-warnings-about-unused-variables/8637/7
The code that generates the warning (as best I can tell) is elixir_errors:warn
and that doesn't have any flags to be able to turn off.
https://github.com/elixir-lang/elixir/search?p=1&q=%3Aelixir_errors.warn&type=&utf8=%E2%9C%93
Nor does it look like there are any code comments you can add to suppress the errors.
Consider it another facet of elixir's very opinionated viewpoint (right along with the "there's only one formatter, and it has no config")
You can stop that particular compiler warning (i. e. test_val is unused
) by proceeding the value with _
. That is, rename the value to _test_val
and you won't get the warning. But if you're warned the variable is unused, maybe you want to double check your code.
© 2022 - 2024 — McMap. All rights reserved.