Skip to content

Commit af13d7f

Browse files
committed
PR Feedback; remove crate name from top line error message
1 parent 4d0da5e commit af13d7f

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

src/librustdoc/core.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,22 +404,14 @@ pub(crate) fn run_global_ctxt(
404404
crate::DOC_RUST_LANG_ORG_VERSION
405405
);
406406

407-
let krate_name = if let Some(name) = krate.module.inner.name {
408-
format!("`{}`'s", name.as_str())
409-
} else {
410-
"this crate's".to_string()
411-
};
412407
let span = tcx.def_span(krate.module.item_id.as_local_def_id().unwrap());
413408

414409
tcx.node_lint(
415410
crate::lint::MISSING_CRATE_LEVEL_DOCS,
416411
DocContext::as_local_hir_id(tcx, krate.module.item_id).unwrap(),
417412
|lint| {
418413
lint.span(span);
419-
lint.primary_message(format!(
420-
"no documentation found for {} top-level module",
421-
krate_name
422-
));
414+
lint.primary_message("no documentation found for this crate's top-level module");
423415
lint.help(help);
424416
},
425417
);

tests/rustdoc-ui/lints/check.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//@ check-pass
22
//@ compile-flags: -Z unstable-options --check
33
//@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"
4-
#![feature(rustdoc_missing_doc_code_examples)] //~ WARN no documentation found for `check`'s top-level module
4+
5+
#![feature(rustdoc_missing_doc_code_examples)] //~ WARN no documentation found for this crate's top-level module
56
//~^ WARN
67

78
#![warn(missing_docs)]
@@ -11,3 +12,4 @@
1112
pub fn foo() {}
1213
//~^ WARN
1314
//~^^ WARN
15+

tests/rustdoc-ui/lints/check.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: missing documentation for the crate
2-
--> $DIR/check.rs:4:1
2+
--> $DIR/check.rs:5:1
33
|
44
LL | / #![feature(rustdoc_missing_doc_code_examples)]
55
LL | |
@@ -10,19 +10,19 @@ LL | | pub fn foo() {}
1010
| |_______________^
1111
|
1212
note: the lint level is defined here
13-
--> $DIR/check.rs:7:9
13+
--> $DIR/check.rs:8:9
1414
|
1515
LL | #![warn(missing_docs)]
1616
| ^^^^^^^^^^^^
1717

1818
warning: missing documentation for a function
19-
--> $DIR/check.rs:11:1
19+
--> $DIR/check.rs:12:1
2020
|
2121
LL | pub fn foo() {}
2222
| ^^^^^^^^^^^^
2323

24-
warning: no documentation found for `check`'s top-level module
25-
--> $DIR/check.rs:4:1
24+
warning: no documentation found for this crate's top-level module
25+
--> $DIR/check.rs:5:1
2626
|
2727
LL | / #![feature(rustdoc_missing_doc_code_examples)]
2828
LL | |
@@ -35,20 +35,20 @@ LL | | pub fn foo() {}
3535
= help: The following guide may be of use:
3636
https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html
3737
note: the lint level is defined here
38-
--> $DIR/check.rs:9:9
38+
--> $DIR/check.rs:10:9
3939
|
4040
LL | #![warn(rustdoc::all)]
4141
| ^^^^^^^^^^^^
4242
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]`
4343

4444
warning: missing code example in this documentation
45-
--> $DIR/check.rs:11:1
45+
--> $DIR/check.rs:12:1
4646
|
4747
LL | pub fn foo() {}
4848
| ^^^^^^^^^^^^^^^
4949
|
5050
note: the lint level is defined here
51-
--> $DIR/check.rs:8:9
51+
--> $DIR/check.rs:9:9
5252
|
5353
LL | #![warn(rustdoc::missing_doc_code_examples)]
5454
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"
2-
#![deny(rustdoc::missing_crate_level_docs)] //~ ERROR no documentation found for `no_crate_level_doc_lint`'s top-level module
2+
#![deny(rustdoc::missing_crate_level_docs)] //~ ERROR no documentation found for this crate's top-level module
33
//^~ NOTE defined here
44

55
pub fn foo() {}

tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: no documentation found for `no_crate_level_doc_lint`'s top-level module
1+
error: no documentation found for this crate's top-level module
22
--> $DIR/no-crate-level-doc-lint.rs:2:1
33
|
44
LL | / #![deny(rustdoc::missing_crate_level_docs)]

0 commit comments

Comments
 (0)