E0029

E0029#

Warning name: unused_package

This warning is emitted when a package is listed as an import but the current package does not use that import directly. Explicit imports from moonbitlang/core are checked as well.

Finding a method or trait implementation through a value's type does not by itself make an explicit import necessary. An import used only for such indirect lookup may therefore still be reported as unused.

Erroneous example#

moon.mod#
name = "moonbit-community/E0029"
lib/moon.pkg#
// This package has no package-specific configuration.
moon.pkg#
import {
  "moonbit-community/E0029/lib", // Warning: Unused package
}

pkgtype(kind: "executable")
top.mbt#
///|
fn main {

}

Suggestion#

Remove the unused package. If the code needs an API from that package directly, refer to it through the package alias instead:

moon.pkg#
pkgtype(kind: "executable")