Merge pull request #330 from vector-im/feature/bma/ktlint

Upgrade of ktlint (not the plugin but the tool itself)
This commit is contained in:
Benoit Marty 2023-04-18 14:03:59 +02:00 committed by GitHub
commit f45e66b6c0
6 changed files with 19 additions and 34 deletions

View file

@ -64,7 +64,7 @@ class StateMachine<Event : Any, State : Any>(
val routesForEvent = routes.filter { it.eventType.isInstance(event) }
return (routesForEvent.firstOrNull { it.fromState?.isInstance(currentState) == true }
?: routesForEvent.firstOrNull { it.fromState == null }) as? StateMachineRoute<E, State, State>
?: routesForEvent.firstOrNull { it.fromState == null }) as? StateMachineRoute<E, State, State>
}
fun restart() {
@ -129,7 +129,7 @@ class StateMachineBuilder<Event : Any, State : Any>(
newRoutes: List<StateMachineRoute<*, *, *>>,
) {
val oldEvents = oldRoutes.filter { it.fromState == state }.map { it.eventType }
val newEvents = newRoutes.filter { it.fromState == state }.map { it.eventType }
val newEvents = newRoutes.filter { it.fromState == state }.map { it.eventType }
val intersection = oldEvents.intersect(newEvents)
if (intersection.isNotEmpty()) {
val duplicates = intersection.joinToString(", ") { it.name }