KT.PREFER_TO_OVER_PAIR_SYNTAX

Usage of the 'Pair()' constructor

This rule detects the usage of the Pair constructor to create pairs of values. Using to is preferred.

Noncompliant Code

Copy
val pair = Pair(1, 2)

Compliant Code

Copy
val pair = 1 to 2

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html