Skip to content

Commit

Permalink
[guppy] add docs_enabled and tests_enabled methods to BuildTarget (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers authored Feb 15, 2025
1 parent 935b2fd commit c8bef2c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions guppy/src/graph/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,9 @@ impl<'a> BuildTargets<'a> {
required_features: target.required_features,
path: target.src_path.into_boxed_path(),
edition: target.edition.to_string().into_boxed_str(),
docs: target.doc,
doc_tests: target.doctest,
tests: target.test,
});
}
}
Expand Down
22 changes: 22 additions & 0 deletions guppy/src/graph/build_targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,30 @@ impl<'g> BuildTarget<'g> {
&self.inner.edition
}

/// Returns true if documentation is enabled for this build target.
#[inline]
pub fn docs_enabled(&self) -> bool {
self.inner.docs
}

/// Returns true if documentation tests are enabled for this build target.
#[inline]
pub fn doc_tests_enabled(&self) -> bool {
self.inner.doc_tests
}

/// Previous name for [`Self::doc_tests_enabled`].
#[deprecated(since = "0.17.15", note = "use `doc_tests_enabled` instead")]
#[inline]
pub fn doc_tests(&self) -> bool {
self.inner.doc_tests
}

/// Returns true if tests are enabled for this build target.
#[inline]
pub fn tests_enabled(&self) -> bool {
self.inner.tests
}
}

/// An identifier for a build target within a package.
Expand Down Expand Up @@ -194,7 +214,9 @@ pub(super) struct BuildTargetImpl {
pub(super) required_features: Vec<String>,
pub(super) path: Box<Utf8Path>,
pub(super) edition: Box<str>,
pub(super) docs: bool,
pub(super) doc_tests: bool,
pub(super) tests: bool,
}

/// Owned version of `BuildTargetId`.
Expand Down

0 comments on commit c8bef2c

Please sign in to comment.