Lambda parameter renaming
authorLanius Trolling <lanius@laniustrolling.dev>
Thu, 2 Mar 2023 16:07:53 +0000 (11:07 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Thu, 2 Mar 2023 16:07:53 +0000 (11:07 -0500)
src/main/kotlin/info/mechyrdia/data/nations.kt
src/main/kotlin/info/mechyrdia/lore/article_listing.kt
src/main/kotlin/info/mechyrdia/lore/view_bar.kt
src/main/kotlin/info/mechyrdia/lore/view_nav.kt

index 417836a5e45dcfd1ae142ad575623085d80d91c9..ef28bdfad308219aa3de6ac200ccaa63a5b4bda1 100644 (file)
@@ -37,8 +37,8 @@ data class NationData(
                                .getNation(id.id)
                                .shards(NationShard.NAME, NationShard.FLAG_URL)
                                .executeSuspend()
-                               ?.let {
-                                       NationData(id = Id(it.id), name = it.name, flag = it.flagUrl)
+                               ?.let { nation ->
+                                       NationData(id = Id(nation.id), name = nation.name, flag = nation.flagUrl)
                                } ?: unknown(id)
                }
        }
@@ -48,8 +48,8 @@ val CallNationCacheAttribute = AttributeKey<MutableMap<Id<NationData>, NationDat
 
 val ApplicationCall.nationCache: MutableMap<Id<NationData>, NationData>
        get() = attributes.getOrNull(CallNationCacheAttribute)
-               ?: mutableMapOf<Id<NationData>, NationData>().also {
-                       attributes.put(CallNationCacheAttribute, it)
+               ?: mutableMapOf<Id<NationData>, NationData>().also { cache ->
+                       attributes.put(CallNationCacheAttribute, cache)
                }
 
 suspend fun MutableMap<Id<NationData>, NationData>.getNation(id: Id<NationData>): NationData {
index 5d4b78d3d2c459994af4aaf844606af8a883020b..e578b5d59870b542d6dbe7a396b55dd468d14499 100644 (file)
@@ -14,8 +14,8 @@ fun File.toArticleNode(): ArticleNode = ArticleNode(
                .orEmpty()
                .map { it.toArticleNode() }
                .sortedBy { it.name }
-               .sortedBy {
-                       if (it.subNodes.isNotEmpty())
+               .sortedBy { node ->
+                       if (node.subNodes.isNotEmpty())
                                0
                        else
                                1
@@ -24,12 +24,12 @@ fun File.toArticleNode(): ArticleNode = ArticleNode(
 
 fun List<ArticleNode>.renderInto(list: UL, base: String? = null) {
        val prefix = base?.let { "$it/" } ?: ""
-       forEach {
+       forEach { node ->
                list.li {
-                       a(href = "/lore/$prefix${it.name}") { +it.name }
-                       if (it.subNodes.isNotEmpty())
+                       a(href = "/lore/$prefix${node.name}") { +node.name }
+                       if (node.subNodes.isNotEmpty())
                                ul {
-                                       it.subNodes.renderInto(this, "$prefix${it.name}")
+                                       node.subNodes.renderInto(this, "$prefix${node.name}")
                                }
                }
        }
index 4859c259dc2735f0e5ef34218dd96e8a5ecb7002..5a9346b88d1ebc414d3fae1f686d088bcf149802 100644 (file)
@@ -11,9 +11,9 @@ abstract class Sidebar {
 data class PageNavSidebar(val contents: List<NavItem>) : Sidebar() {
        override fun TagConsumer<*>.display() {
                div(classes = "list") {
-                       for (it in contents) {
+                       for (content in contents) {
                                div(classes = "item") {
-                                       it.displayIn(this)
+                                       content.displayIn(this)
                                }
                        }
                }
index f71bcd95979e6071365ade3b37e43ef7d0c7fd70..d6c8a322e5f3182c1a6f0214f37d726d32c2869c 100644 (file)
@@ -22,11 +22,11 @@ suspend fun ApplicationCall.standardNavBar(path: List<String>? = null) = listOf(
 }.orEmpty() + listOf(
        NavHead("Client Preferences"),
        NavLink("/change-theme", "Light/Dark Mode"),
-) + (currentNation()?.let {
+) + (currentNation()?.let { data ->
        listOf(
-               NavHead(it.name),
-               NavLink("/user/${it.id}", "Your User Page"),
-               NavLink("https://nationstates.net/${it.id}", "Your NationStates Page"),
+               NavHead(data.name),
+               NavLink("/user/${data.id}", "Your User Page"),
+               NavLink("https://nationstates.net/${data.id}", "Your NationStates Page"),
                NavLink("/auth/logout", "Log Out", linkAttributes = mapOf("data-method" to "post", "data-csrf-token" to createCsrfToken("/auth/logout")))
        )
 } ?: listOf(