Skip to content

Commit b28bbde

Browse files
committed
Improve 'use instead' section of lint doc
1 parent d0e1e4c commit b28bbde

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

clippy_lints/src/field_scoped_visibility_modifiers.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,16 @@ declare_clippy_lint! {
2828
/// ```no_run
2929
/// pub mod public_module {
3030
/// struct MyStruct {
31-
/// pub first_field: bool,
32-
/// pub second_field: bool
31+
/// first_field: bool,
32+
/// second_field: bool
33+
/// }
34+
/// impl MyStruct {
35+
/// pub(crate) fn get_first_field(&self) -> bool {
36+
/// self.first_field
37+
/// }
38+
/// pub(super) fn get_second_field(&self) -> bool {
39+
/// self.second_field
40+
/// }
3341
/// }
3442
/// }
3543
/// ```
@@ -60,7 +68,7 @@ impl EarlyLintPass for FieldScopedVisibilityModifiers {
6068
field.vis.span,
6169
"scoped visibility modifier on a field",
6270
None,
63-
"consider making the field either public or private",
71+
"consider making the field private and adding a scoped visibility method to read it",
6472
);
6573
}
6674
}

0 commit comments

Comments
 (0)