Skip to content

Commit

Permalink
Simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
andersu committed Mar 2, 2022
1 parent b898f80 commit 11bb0f4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions common/src/main/kotlin/org/amshove/kluent/Collections.kt
Expand Up @@ -847,9 +847,7 @@ infix fun <T, I : Iterable<T>> I.shouldContainNone(expected: Array<T>): I =
infix fun <T, I : Iterable<T>> I.shouldContainNone(check: (T) -> Boolean): I = apply {
val result = this.map { it to check.invoke(it) }

if (result.none { it.second }) {
Unit
} else {
if (result.any { it.second }) {
val failedItems = result
.filterNot { it.second }
.map { it.first }
Expand Down Expand Up @@ -902,9 +900,7 @@ infix fun <T, I : Iterable<T>> I.shouldNotContainAny(expected: Array<T>): I =
infix fun <T, I : Iterable<T>> I.shouldNotContainAny(check: (T) -> Boolean): I = apply {
val result = this.map { it to check.invoke(it) }

if (result.none { it.second }) {
Unit
} else {
if (result.any { it.second }) {
val failedItems = result
.filterNot { it.second }
.map { it.first }
Expand Down

0 comments on commit 11bb0f4

Please sign in to comment.