Skip to content

Commit 2def81a

Browse files
Store nightly build instead of checking env var every time
1 parent d638563 commit 2def81a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ declare_lint! {
313313
}
314314

315315
declare_lint! {
316-
pub MISSING_DOC_ITEM_CODE_EXAMPLE,
316+
pub MISSING_DOC_CODE_EXAMPLES,
317317
Allow,
318318
"warn about missing code example in an item's documentation"
319319
}

src/librustdoc/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pub fn run_core(search_paths: SearchPaths,
348348
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
349349
let warnings_lint_name = lint::builtin::WARNINGS.name;
350350
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
351-
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_ITEM_CODE_EXAMPLE.name;
351+
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
352352

353353
// In addition to those specific lints, we also need to whitelist those given through
354354
// command line, otherwise they'll get ignored and we don't want that.

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ enum PathKind {
5757
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
5858
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
5959
mod_ids: Vec<NodeId>,
60+
is_nightly_build: bool,
6061
}
6162

6263
impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
6364
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
6465
LinkCollector {
6566
cx,
6667
mod_ids: Vec::new(),
68+
is_nightly_build: UnstableFeatures::from_environment().is_nightly_build(),
6769
}
6870
}
6971

@@ -240,7 +242,7 @@ fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
240242
if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() {
241243
if tests.found_tests == 0 {
242244
let mut diag = cx.tcx.struct_span_lint_node(
243-
lint::builtin::MISSING_DOC_ITEM_CODE_EXAMPLE,
245+
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
244246
NodeId::new(0),
245247
span_of_attrs(&item.attrs),
246248
"Missing code example in this documentation");
@@ -313,7 +315,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for LinkCollector<'a, 'tcx, 'rcx, 'cstor
313315

314316
look_for_tests(&cx, &dox, &item);
315317

316-
if !UnstableFeatures::from_environment().is_nightly_build() {
318+
if !self.is_nightly_build {
317319
return None;
318320
}
319321

0 commit comments

Comments
 (0)