E3003#
init
与 main
函数不得有参数列表或返回类型。
备注
The case of fn main() -> Unit
is exceptionally accepted
and can be corrected by the formatter.
错误示例#
///|
/// `init` function must have no arguments and no return value.
fn init() -> Unit {
}
///|
/// Error: Unused parameter list for the main function.
fn main() {
println("Hello, world!")
}
建议#
删除参数列表和返回类型注释,如:
///|
fn init {
}
///|
fn main {
println("Hello, world!")
}