File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ declare_clippy_lint! {
2323 /// struct FileHandle {
2424 /// _descriptor: usize,
2525 /// }
26+ /// // OR
27+ /// struct FileHandle {
28+ /// pub descriptor: usize,
29+ /// }
2630 /// ```
2731 #[ clippy:: version = "1.74.0" ]
2832 pub PUB_UNDERSCORE_FIELDS ,
@@ -38,16 +42,15 @@ impl EarlyLintPass for PubUnderscoreFields {
3842 return ;
3943 } ;
4044
41- let msg = "field marked as public but also inferred as unused because it's prefixed with `_`" ;
42- for field in st. fields ( ) . iter ( ) {
45+ for field in st. fields ( ) {
4346 if let Some ( ident) = field. ident . as_ref ( )
4447 && ident. as_str ( ) . starts_with ( '_' )
4548 && !matches ! ( field. vis. kind, VisibilityKind :: Inherited ) {
4649 span_lint_and_help (
4750 cx,
4851 PUB_UNDERSCORE_FIELDS ,
4952 field. vis . span . to ( ident. span ) ,
50- msg ,
53+ "field marked as public but also inferred as unused because it's prefixed with `_`" ,
5154 None ,
5255 "consider removing the underscore, or making the field private" ,
5356 ) ;
You can’t perform that action at this time.
0 commit comments