Skip to content

Commit

Permalink
Use doc(cfg) to annotate feature-gated items
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Aug 19, 2020
1 parent 836686a commit 73c15f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rand_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![allow(clippy::unreadable_literal)]
#![cfg_attr(not(feature = "std"), no_std)]

#![cfg_attr(nightly, feature(doc_cfg))]

use core::convert::AsMut;
use core::default::Default;
Expand Down Expand Up @@ -364,6 +364,7 @@ pub trait SeedableRng: Sized {
///
/// [`getrandom`]: https://docs.rs/getrandom
#[cfg(feature = "getrandom")]
#[cfg_attr(nightly, doc(cfg(feature = "getrandom")))]
fn from_entropy() -> Self {
let mut seed = Self::Seed::default();
if let Err(err) = getrandom::getrandom(seed.as_mut()) {
Expand Down
1 change: 1 addition & 0 deletions rand_core/src/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use getrandom::getrandom;
/// ```
///
/// [getrandom]: https://crates.io/crates/getrandom
#[cfg_attr(nightly, doc(cfg(feature = "getrandom")))]
#[derive(Clone, Copy, Debug, Default)]
pub struct OsRng;

Expand Down

0 comments on commit 73c15f9

Please sign in to comment.