报告评估为 Option 的 if 语句,并建议将其替换为 filter。
Option
filter
示例:
def condition(x: Int): Boolean = ??? val value = 3 if (condition(value)) Some(value) else None
在应用快速修复后:
def condition(x: Int): Boolean = ??? val value = 3 Some(value).filter(condition)