Skip to content

Commit 0de451d

Browse files
committed
Use 'doc_cfg' only when building docs.
Resolves #177.
1 parent 434721e commit 0de451d

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/jar.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl CookieJar {
410410
/// assert!(jar.get("private").is_some());
411411
/// ```
412412
#[cfg(feature = "private")]
413-
#[cfg_attr(nightly, doc(cfg(feature = "private")))]
413+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "private")))]
414414
pub fn private<'a>(&'a self, key: &Key) -> PrivateJar<&'a Self> {
415415
PrivateJar::new(self, key)
416416
}
@@ -438,7 +438,7 @@ impl CookieJar {
438438
/// jar.private_mut(&key).remove(Cookie::named("private"));
439439
/// ```
440440
#[cfg(feature = "private")]
441-
#[cfg_attr(nightly, doc(cfg(feature = "private")))]
441+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "private")))]
442442
pub fn private_mut<'a>(&'a mut self, key: &Key) -> PrivateJar<&'a mut Self> {
443443
PrivateJar::new(self, key)
444444
}
@@ -473,7 +473,7 @@ impl CookieJar {
473473
/// assert!(jar.get("signed").is_some());
474474
/// ```
475475
#[cfg(feature = "signed")]
476-
#[cfg_attr(nightly, doc(cfg(feature = "signed")))]
476+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "signed")))]
477477
pub fn signed<'a>(&'a self, key: &Key) -> SignedJar<&'a Self> {
478478
SignedJar::new(self, key)
479479
}
@@ -500,7 +500,7 @@ impl CookieJar {
500500
/// jar.signed_mut(&key).remove(Cookie::named("signed"));
501501
/// ```
502502
#[cfg(feature = "signed")]
503-
#[cfg_attr(nightly, doc(cfg(feature = "signed")))]
503+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "signed")))]
504504
pub fn signed_mut<'a>(&'a mut self, key: &Key) -> SignedJar<&'a mut Self> {
505505
SignedJar::new(self, key)
506506
}

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
//! features = ["secure", "percent-encode"]
7575
//! ```
7676
77-
#![cfg_attr(nightly, feature(doc_cfg))]
77+
#![cfg_attr(all(nightly, doc), feature(doc_cfg))]
7878

7979
#![doc(html_root_url = "https://docs.rs/cookie/0.15")]
8080
#![deny(missing_docs)]
@@ -308,7 +308,7 @@ impl<'c> Cookie<'c> {
308308
/// assert_eq!(c.http_only(), Some(true));
309309
/// ```
310310
#[cfg(feature = "percent-encode")]
311-
#[cfg_attr(nightly, doc(cfg(feature = "percent-encode")))]
311+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "percent-encode")))]
312312
pub fn parse_encoded<S>(s: S) -> Result<Cookie<'c>, ParseError>
313313
where S: Into<Cow<'c, str>>
314314
{
@@ -1095,7 +1095,7 @@ impl<'c> Cookie<'c> {
10951095
/// assert_eq!(&c.encoded().stripped().to_string(), "my%20name=this%3B%20value%3F");
10961096
/// ```
10971097
#[cfg(feature = "percent-encode")]
1098-
#[cfg_attr(nightly, doc(cfg(feature = "percent-encode")))]
1098+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "percent-encode")))]
10991099
#[inline(always)]
11001100
pub fn encoded<'a>(&'a self) -> Display<'a, 'c> {
11011101
Display::new_encoded(self)
@@ -1214,7 +1214,7 @@ impl<'a, 'c> Display<'a, 'c> {
12141214
/// Percent-encode the name and value pair.
12151215
#[inline]
12161216
#[cfg(feature = "percent-encode")]
1217-
#[cfg_attr(nightly, doc(cfg(feature = "percent-encode")))]
1217+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "percent-encode")))]
12181218
pub fn encoded(mut self) -> Self {
12191219
self.encode = true;
12201220
self

src/secure/key.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const_assert!(crate::secure::private::KEY_LEN == ENCRYPTION_KEY_LEN);
1414
/// [`PrivateJar`](crate::PrivateJar) and [`SignedJar`](crate::SignedJar). A
1515
/// single instance of a `Key` can be used for both a `PrivateJar` and a
1616
/// `SignedJar` simultaneously with no notable security implications.
17-
#[cfg_attr(nightly, doc(cfg(any(feature = "private", feature = "signed"))))]
17+
#[cfg_attr(all(nightly, doc), doc(cfg(any(feature = "private", feature = "signed"))))]
1818
#[derive(Clone)]
1919
pub struct Key([u8; COMBINED_KEY_LENGTH /* SIGNING | ENCRYPTION */]);
2020

@@ -86,7 +86,7 @@ impl Key {
8686
/// let key = Key::derive_from(master_key);
8787
/// ```
8888
#[cfg(feature = "key-expansion")]
89-
#[cfg_attr(nightly, doc(cfg(feature = "key-expansion")))]
89+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "key-expansion")))]
9090
pub fn derive_from(master_key: &[u8]) -> Self {
9191
if master_key.len() < 32 {
9292
panic!("bad master key length: expected >= 32 bytes, found {}", master_key.len());

src/secure/private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(crate) const KEY_LEN: usize = 32;
2323
/// `PrivateJar` are simultaneously assured confidentiality, integrity, and
2424
/// authenticity. In other words, clients cannot discover nor tamper with the
2525
/// contents of a cookie, nor can they fabricate cookie data.
26-
#[cfg_attr(nightly, doc(cfg(feature = "private")))]
26+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "private")))]
2727
pub struct PrivateJar<J> {
2828
parent: J,
2929
key: [u8; KEY_LEN]

src/secure/signed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub(crate) const KEY_LEN: usize = 32;
1919
/// integrity and authenticity. In other words, clients cannot tamper with the
2020
/// contents of a cookie nor can they fabricate cookie values, but the data is
2121
/// visible in plaintext.
22-
#[cfg_attr(nightly, doc(cfg(feature = "signed")))]
22+
#[cfg_attr(all(nightly, doc), doc(cfg(feature = "signed")))]
2323
pub struct SignedJar<J> {
2424
parent: J,
2525
key: [u8; KEY_LEN],

0 commit comments

Comments
 (0)