Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct docsrs feature annotation #248

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl Engine {
/// # }
/// ```
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub fn add_policy_from_file<P: AsRef<std::path::Path>>(&mut self, path: P) -> Result<String> {
let source = Source::from_file(path)?;
let mut parser = Parser::new(&source)?;
Expand Down Expand Up @@ -644,7 +645,7 @@ impl Engine {
}

#[cfg(feature = "coverage")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "coverage")))]
#[cfg_attr(docsrs, doc(cfg(feature = "coverage")))]
/// Get the coverage report.
///
/// ```rust
Expand Down Expand Up @@ -688,7 +689,7 @@ impl Engine {
}

#[cfg(feature = "coverage")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "coverage")))]
#[cfg_attr(docsrs, doc(cfg(feature = "coverage")))]
/// Enable/disable policy coverage.
///
/// If `enable` is different from the current value, then any existing coverage
Expand All @@ -698,7 +699,7 @@ impl Engine {
}

#[cfg(feature = "coverage")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "coverage")))]
#[cfg_attr(docsrs, doc(cfg(feature = "coverage")))]
/// Clear the gathered policy coverage data.
pub fn clear_coverage_data(&mut self) {
self.interpreter.clear_coverage_data()
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// Use README.md as crate documentation.
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))]
#![cfg_attr(docsrs, feature(doc_cfg))]
// We'll default to building for no_std - use core, alloc instead of std.
#![no_std]

Expand Down
5 changes: 5 additions & 0 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ impl Value {
/// # }
/// ```
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub fn from_json_file<P: AsRef<std::path::Path>>(path: P) -> Result<Value> {
match std::fs::read_to_string(&path) {
Ok(c) => Self::from_json_str(c.as_str()),
Expand Down Expand Up @@ -400,6 +401,7 @@ impl Value {
/// Deserialize a value from YAML.
/// Note: Deserialization from YAML does not support arbitrary precision numbers.
#[cfg(feature = "yaml")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub fn from_yaml_str(yaml: &str) -> Result<Value> {
Ok(serde_yaml::from_str(yaml)?)
}
Expand All @@ -408,6 +410,8 @@ impl Value {
/// Note: Deserialization from YAML does not support arbitrary precision numbers.
#[cfg(feature = "std")]
#[cfg(feature = "yaml")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "yaml")))]
pub fn from_yaml_file(path: &String) -> Result<Value> {
match std::fs::read_to_string(path) {
Ok(c) => Self::from_yaml_str(c.as_str()),
Expand Down Expand Up @@ -609,6 +613,7 @@ impl From<serde_json::Value> for Value {
}

#[cfg(feature = "yaml")]
#[cfg_attr(docsrs, doc(cfg(feature = "yaml")))]
impl From<serde_yaml::Value> for Value {
/// Create a [`Value`] from [`serde_yaml::Value`].
///
Expand Down
Loading