Skip to content

Commit

Permalink
Improve 'use instead' section of lint doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleoneill committed Jun 13, 2024
1 parent d0e1e4c commit b28bbde
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions clippy_lints/src/field_scoped_visibility_modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// }
/// }
/// }
/// ```
Expand Down Expand Up @@ -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",
);
}
}
Expand Down

0 comments on commit b28bbde

Please sign in to comment.