Replace map { ... }.filterNotNull() with mapNotNull { ... }

This commit is contained in:
Ilya Gorbunov
2015-11-13 23:43:05 +03:00
parent 5b02a59cb7
commit 32151c077e
112 changed files with 197 additions and 269 deletions
@@ -45,9 +45,9 @@ public fun cliPluginUsageString(pluginId: String, options: Collection<CliOption>
"\n" + " ".repeat(MAX_OPTION_WIDTH + LEFT_INDENT + 1)
} else " ".repeat(1 + MAX_OPTION_WIDTH - name.length())
val modifiers = listOf(
val modifiers = listOfNotNull(
if (it.required) "required" else null,
if (it.allowMultipleOccurrences) "multiple" else null).filterNotNull()
if (it.allowMultipleOccurrences) "multiple" else null)
val modifiersEnclosed = if (modifiers.isEmpty()) "" else " (${modifiers.joinToString()})"
" ".repeat(LEFT_INDENT) + name + margin + it.description + modifiersEnclosed