diff --git a/clippy_lints/src/field_scoped_visibility_modifiers.rs b/clippy_lints/src/field_scoped_visibility_modifiers.rs index 49773909f380..3e29b2a959aa 100644 --- a/clippy_lints/src/field_scoped_visibility_modifiers.rs +++ b/clippy_lints/src/field_scoped_visibility_modifiers.rs @@ -28,8 +28,16 @@ declare_clippy_lint! { /// ```no_run /// pub mod public_module { /// struct MyStruct { - /// pub first_field: bool, - /// pub second_field: bool + /// first_field: bool, + /// second_field: bool + /// } + /// impl MyStruct { + /// pub(crate) fn get_first_field(&self) -> bool { + /// self.first_field + /// } + /// pub(super) fn get_second_field(&self) -> bool { + /// self.second_field + /// } /// } /// } /// ``` @@ -60,7 +68,7 @@ impl EarlyLintPass for FieldScopedVisibilityModifiers { field.vis.span, "scoped visibility modifier on a field", None, - "consider making the field either public or private", + "consider making the field private and adding a scoped visibility method to read it", ); } }