E0063#
警告名称:syntax_lint
语法 lint 警告。
编译器会接受此类合法代码模式,但并不推荐。例如,为已提供的可选参数显式包装 Some 是不必要的:
///|
pub fn consume(value? : Int) -> Unit {
ignore(value)
}
///|
pub fn demo() -> Unit {
consume(value?=Some(42))
}
建议#
为可选参数提供值时,直接传入该值:
///|
pub fn consume(value? : Int) -> Unit {
ignore(value)
}
///|
pub fn demo() -> Unit {
consume(value=42)
}
其他语法 lint 诊断可能会报告不同的反模式,并针对正在检查的代码给出相应建议。