# E0001

Warning name: `unused_value`

Unused function.

This function is not used by any other part of your code, nor marked with `pub`
visibility.

Note that this warning might uncover other bugs in your code. For example, if
there are two functions in your codebase that has similar name, you might just
call the other function by mistake.

## Erroneous example

```{literalinclude} /sources/error_codes/0001_error/top.mbt
:language: moonbit
```

## Suggestion

There are multiple ways to fix this warning:

- If the function is indeed useless, you can remove the definition of the
  function.
- If this function is at the toplevel (i.e., not local), and is part of the
  public API of your module, you can add the `pub` keyword to the function.
  ```{literalinclude} /sources/error_codes/0001_fixed/top.mbt
  :language: moonbit
  :start-after: make public
  :end-before: end make public
  ```

- If you made a typo in the function name, you can rename the function to the
  correct name at the call site.

There are some cases where you might want to keep the function private and
unused at the same time. In this case, you can call `ignore()` on the function
to force the use of it.

```{literalinclude} /sources/error_codes/0001_fixed/top.mbt
:language: moonbit
:start-after: ignore unused
:end-before: end ignore unused
```
