E1008#
修饰符(pub
/priv
)在这里是多余的,因为这个字段默认具有这样的可见性。
错误示例#
struct A {
priv value : Int
// Warning: The private modifier is redundant here
// since field value is private by default
}
pub struct B {
pub value : Int
// Warning: The public modifier is redundant here
// since field value is public by default
}
建议#
移除字段上的可见性修饰符。
struct A {
value : Int
}
pub struct B {
value : Int
}