Skip to content

Commit 1f79406

Browse files
committed
---
yaml --- r: 141262 b: refs/heads/try2 c: 3d61931 h: refs/heads/master v: v3
1 parent d329db4 commit 1f79406

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c6581325ac38ce3f96cb7a0ea0aad35feed173c1
8+
refs/heads/try2: 3d61931fcac13aadc88ece7e48567f7ff503fba5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/lint.rs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -972,16 +972,23 @@ fn lint_unnecessary_allocations(cx: @mut Context) -> visit::vt<()> {
972972
fn lint_missing_struct_doc(cx: @mut Context) -> visit::vt<()> {
973973
visit::mk_simple_visitor(@visit::SimpleVisitor {
974974
visit_struct_field: |field| {
975-
let mut has_doc = false;
976-
for field.node.attrs.each |attr| {
977-
if attr.node.is_sugared_doc {
978-
has_doc = true;
979-
break;
975+
let relevant = match field.node.kind {
976+
ast::named_field(_, vis) => vis != ast::private,
977+
ast::unnamed_field => false,
978+
};
979+
980+
if relevant {
981+
let mut has_doc = false;
982+
for field.node.attrs.each |attr| {
983+
if attr.node.is_sugared_doc {
984+
has_doc = true;
985+
break;
986+
}
987+
}
988+
if !has_doc {
989+
cx.span_lint(missing_struct_doc, field.span, "missing documentation \
990+
for a field.");
980991
}
981-
}
982-
if !has_doc {
983-
cx.span_lint(missing_struct_doc, field.span, "missing documentation \
984-
for a field.");
985992
}
986993
},
987994
.. *visit::default_simple_visitor()
@@ -1003,18 +1010,22 @@ fn lint_missing_trait_doc(cx: @mut Context) -> visit::vt<()> {
10031010
m.span
10041011
},
10051012
ast::provided(m) => {
1006-
for m.attrs.each |attr| {
1007-
if attr.node.is_sugared_doc {
1008-
has_doc = true;
1009-
break;
1013+
if m.vis == ast::private {
1014+
has_doc = true;
1015+
} else {
1016+
for m.attrs.each |attr| {
1017+
if attr.node.is_sugared_doc {
1018+
has_doc = true;
1019+
break;
1020+
}
10101021
}
10111022
}
10121023
m.span
10131024
}
10141025
};
10151026
if !has_doc {
10161027
cx.span_lint(missing_trait_doc, span, "missing documentation \
1017-
for a method.");
1028+
for a method.");
10181029
}
10191030
},
10201031
.. *visit::default_simple_visitor()

0 commit comments

Comments
 (0)