Skip to content

Commit b97343f

Browse files
author
José Valim
committed
Add documentation about import warnings
1 parent 7b41ff3 commit b97343f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/elixir/lib/kernel/special_forms.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,19 @@ defmodule Kernel.SpecialForms do
305305
also accepts `as:` as an option so it automatically sets up
306306
an alias. Please check `alias` for more information.
307307
308+
## Warnings
309+
310+
If you import a module and you don't use any of the imported
311+
functions or macros from this module, Elixir is going to issue
312+
a warning implying the import is not being used.
313+
314+
In case the import is generated automatically by a macro,
315+
Elixir won't emit any warnings though, since the import
316+
was not explicitly defined.
317+
318+
Both warning behaviors could be changed by explicitily
319+
setting the `:warn` option to true or false.
320+
308321
## Ambiguous function/macro names
309322
310323
If two modules `A` and `B` are imported and they both contain

0 commit comments

Comments
 (0)