Inspectopedia
 
2024.3

Expression body syntax is preferable here

Info
New
Last modified: 03 December 2024

Reports 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.

Example:

After the quick-fix is applied: