Skip to content

Files

Latest commit

 

History

History
35 lines (22 loc) · 542 Bytes

UnnecessaryParentheses.md

File metadata and controls

35 lines (22 loc) · 542 Bytes

Pattern: Unnecessary () around expression

Issue: -

Description

Unnecessary parentheses can be safely removed.

Example of incorrect code:

val local = (5 + 3)

if ((local == 8)) { }

fun foo() {
    function({ input -> println(input) })
}

Example of correct code:

val local = 5 + 3

if (local == 8) { }

fun foo() {
    function { input -> println(input) }
}

Further Reading