Store nightly build instead of checking env var every time
This commit is contained in:
parent
d6385631f4
commit
2def81a5f1
3 changed files with 6 additions and 4 deletions
|
|
@ -313,7 +313,7 @@ declare_lint! {
|
|||
}
|
||||
|
||||
declare_lint! {
|
||||
pub MISSING_DOC_ITEM_CODE_EXAMPLE,
|
||||
pub MISSING_DOC_CODE_EXAMPLES,
|
||||
Allow,
|
||||
"warn about missing code example in an item's documentation"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
|
||||
let warnings_lint_name = lint::builtin::WARNINGS.name;
|
||||
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
|
||||
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_ITEM_CODE_EXAMPLE.name;
|
||||
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
|
||||
|
||||
// In addition to those specific lints, we also need to whitelist those given through
|
||||
// command line, otherwise they'll get ignored and we don't want that.
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ enum PathKind {
|
|||
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
mod_ids: Vec<NodeId>,
|
||||
is_nightly_build: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
|
|
@ -64,6 +65,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
|
|||
LinkCollector {
|
||||
cx,
|
||||
mod_ids: Vec::new(),
|
||||
is_nightly_build: UnstableFeatures::from_environment().is_nightly_build(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +242,7 @@ fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
|
|||
if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() {
|
||||
if tests.found_tests == 0 {
|
||||
let mut diag = cx.tcx.struct_span_lint_node(
|
||||
lint::builtin::MISSING_DOC_ITEM_CODE_EXAMPLE,
|
||||
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
|
||||
NodeId::new(0),
|
||||
span_of_attrs(&item.attrs),
|
||||
"Missing code example in this documentation");
|
||||
|
|
@ -313,7 +315,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for LinkCollector<'a, 'tcx, 'rcx, 'cstor
|
|||
|
||||
look_for_tests(&cx, &dox, &item);
|
||||
|
||||
if !UnstableFeatures::from_environment().is_nightly_build() {
|
||||
if !self.is_nightly_build {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue