This rule inspects casts and reports casts which could be replaced with safe casts instead.
fun numberMagic(number: Number) { val i = if (number is Int) number else null // ...}
fun numberMagic(number: Number) { val i = number as? Int // ...}
The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html