Skip to content

Commit b029ab0

Browse files
zeroize: add doc_cfg (#505)
Intended to be rendered on https://docs.rs
1 parent e4c107c commit b029ab0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

zeroize/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ alloc = []
2929

3030
[package.metadata.docs.rs]
3131
all-features = true
32+
rustdoc-args = ["--cfg", "docsrs"]

zeroize/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
//! [good cryptographic hygiene]: https://github.com/veorq/cryptocoding#clean-memory-of-secret-data
208208
209209
#![no_std]
210+
#![cfg_attr(docsrs, feature(doc_cfg))]
210211
#![doc(html_root_url = "https://docs.rs/zeroize/1.1.0")]
211212
#![warn(missing_docs, rust_2018_idioms, trivial_casts, unused_qualifications)]
212213

@@ -215,12 +216,9 @@
215216
extern crate alloc;
216217

217218
#[cfg(feature = "zeroize_derive")]
219+
#[cfg_attr(docsrs, doc(cfg(feature = "zeroize_derive")))]
218220
pub use zeroize_derive::Zeroize;
219221

220-
#[cfg(feature = "zeroize_derive")]
221-
#[doc(hidden)]
222-
pub use zeroize_derive::*;
223-
224222
use core::{ops, ptr, slice::IterMut, sync::atomic};
225223

226224
#[cfg(feature = "alloc")]
@@ -328,6 +326,7 @@ where
328326
}
329327

330328
#[cfg(feature = "alloc")]
329+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
331330
impl<Z> Zeroize for Vec<Z>
332331
where
333332
Z: Zeroize,
@@ -372,6 +371,7 @@ where
372371
}
373372

374373
#[cfg(feature = "alloc")]
374+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
375375
impl Zeroize for String {
376376
fn zeroize(&mut self) {
377377
unsafe { self.as_bytes_mut() }.zeroize();

0 commit comments

Comments
 (0)