Skip to content

Commit

Permalink
Fix unused import when import is duplicated (#1129)
Browse files Browse the repository at this point in the history
* Fix unused import when import is duplicated

ktlint detects unused imports, such as:

```
import lib
import lib2 // <- ktlint unused import rule is violated

fun main() {
	lib.function();
}
```

However, when an import is duplicated -- and the duplicate import line is thus an unused import -- ktlint emits no rule violation.

E.g:

```
import lib
import lib // unused, but no violation

fun main() {
	lib.function();
```

This commit fixes that, emitting a rule violation when two imports have the same import path.

* Revert verification metadata

* fix lint

Co-authored-by: Yahor Berdnikau <[email protected]>
Co-authored-by: Sha Sha Chu <[email protected]>
  • Loading branch information
3 people authored Aug 5, 2021
1 parent 66eef59 commit 3a43dbb
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 1,796 deletions.
Loading

0 comments on commit 3a43dbb

Please sign in to comment.