Pattern: Unnecessary apply
Issue: -
apply
expressions are used frequently, but sometimes their usage should be replaced with an ordinary method/extension function call to reduce visual complexity.
Example of incorrect code:
config.apply { version = "1.2" } // can be replaced with config.version = "1.2"
config?.apply { environment = "test" } // can be replaced with config?.environment = "test"
Example of correct code:
config.apply {
version = "1.2"
environment = "test"
}