Skip to content

Commit 8a6f150

Browse files
Merge pull request #71 from square/zachklipp/remove-extra-parens
Remove redundant parentheses after @composable annotations.
2 parents 84a0c4d + 80c4a75 commit 8a6f150

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ subprojects {
9999
setOf(
100100
// IntelliJ refuses to sort imports correctly.
101101
// This is a known issue: https://github.com/pinterest/ktlint/issues/527
102-
"import-ordering"
102+
"import-ordering",
103+
// Ktlint doesn't know how to handle nullary annotations on function types, e.g.
104+
// @Composable () -> Unit.
105+
"paren-spacing"
103106
)
104107
)
105108
}

core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeRendering.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import com.squareup.workflow.ui.ViewFactory
3232
* To use this type, make sure your `ViewRegistry` registers [Factory].
3333
*/
3434
class ComposeRendering internal constructor(
35-
internal val render: @Composable() (ViewEnvironment) -> Unit
35+
internal val render: @Composable (ViewEnvironment) -> Unit
3636
) {
3737
companion object {
3838
/**

core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeViewFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import kotlin.reflect.KClass
8080
* with the [CompositionRoot]. See the documentation on [CompositionRoot] for more information.
8181
*/
8282
inline fun <reified RenderingT : Any> composedViewFactory(
83-
noinline showRendering: @Composable() (
83+
noinline showRendering: @Composable (
8484
rendering: RenderingT,
8585
environment: ViewEnvironment
8686
) -> Unit
@@ -89,7 +89,7 @@ inline fun <reified RenderingT : Any> composedViewFactory(
8989
@PublishedApi
9090
internal class ComposeViewFactory<RenderingT : Any>(
9191
override val type: KClass<RenderingT>,
92-
internal val content: @Composable() (RenderingT, ViewEnvironment) -> Unit
92+
internal val content: @Composable (RenderingT, ViewEnvironment) -> Unit
9393
) : ViewFactory<RenderingT> {
9494

9595
@OptIn(ExperimentalComposeApi::class)

core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeWorkflow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ abstract class ComposeWorkflow<in PropsT, out OutputT : Any> :
6363
* Returns a [ComposeWorkflow] that renders itself using the given [render] function.
6464
*/
6565
inline fun <PropsT, OutputT : Any> Workflow.Companion.composed(
66-
crossinline render: @Composable() (
66+
crossinline render: @Composable (
6767
props: PropsT,
6868
outputSink: Sink<OutputT>,
6969
environment: ViewEnvironment

core-compose/src/main/java/com/squareup/workflow/ui/compose/CompositionRoot.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private val HasViewFactoryRootBeenApplied = staticAmbientOf { false }
4141
* However, ambients are propagated down to child [composedViewFactory] compositions, so any
4242
* ambients provided here will be available in _all_ [composedViewFactory] compositions.
4343
*/
44-
typealias CompositionRoot = @Composable() (content: @Composable() () -> Unit) -> Unit
44+
typealias CompositionRoot = @Composable (content: @Composable () -> Unit) -> Unit
4545

4646
/**
4747
* Convenience function for applying a [CompositionRoot] to this [ViewEnvironment]'s [ViewRegistry].
@@ -75,7 +75,7 @@ fun ViewRegistry.withCompositionRoot(root: CompositionRoot): ViewRegistry =
7575
@VisibleForTesting(otherwise = PRIVATE)
7676
@Composable internal fun wrapWithRootIfNecessary(
7777
root: CompositionRoot,
78-
content: @Composable() () -> Unit
78+
content: @Composable () -> Unit
7979
) {
8080
if (HasViewFactoryRootBeenApplied.current) {
8181
// The only way this ambient can have the value true is if, somewhere above this point in the

samples/src/main/java/com/squareup/sample/launcher/Samples.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ data class Sample(
5858
val name: String,
5959
val activityClass: KClass<out ComponentActivity>,
6060
val description: String,
61-
val preview: @Composable() () -> Unit
61+
val preview: @Composable () -> Unit
6262
)

0 commit comments

Comments
 (0)