Expression body syntax is preferable here
return expressions (one-liners or
when) that can be replaced with expression body syntax.
Expression body syntax is recommended by the style guide.
Convert to expression body quick-fix can be used to amend the code automatically.
After the quick-fix is applied:
IntelliJ IDEA 2023.3, Qodana for JVM 2023.3