File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,15 @@ declare_clippy_lint! {
2020 /// ```
2121 /// Use instead:
2222 /// ```rust
23- /// struct FileHandle {
23+ /// struct FileHandle_Foo {
2424 /// _descriptor: usize,
2525 /// }
26+ ///
27+ /// // OR
28+ ///
29+ /// struct FileHandle_Bar {
30+ /// pub descriptor: usize,
31+ /// }
2632 /// ```
2733 #[ clippy:: version = "1.74.0" ]
2834 pub PUB_UNDERSCORE_FIELDS ,
@@ -38,16 +44,15 @@ impl EarlyLintPass for PubUnderscoreFields {
3844 return ;
3945 } ;
4046
41- let msg = "field marked as public but also inferred as unused because it's prefixed with `_`" ;
42- for field in st. fields ( ) . iter ( ) {
47+ for field in st. fields ( ) {
4348 if let Some ( ident) = field. ident . as_ref ( )
4449 && ident. as_str ( ) . starts_with ( '_' )
4550 && !matches ! ( field. vis. kind, VisibilityKind :: Inherited ) {
4651 span_lint_and_help (
4752 cx,
4853 PUB_UNDERSCORE_FIELDS ,
4954 field. vis . span . to ( ident. span ) ,
50- msg ,
55+ "field marked as public but also inferred as unused because it's prefixed with `_`" ,
5156 None ,
5257 "consider removing the underscore, or making the field private" ,
5358 ) ;
You can’t perform that action at this time.
0 commit comments