Skip to content

Commit ebac913

Browse files
committed
Use doc(cfg) for docs.rs
Also, remove some usage of `cfg_if!` since the macro seemed to be preventing `cfg(doc)` from being auto-populated.
1 parent 399f952 commit ebac913

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

oauth1-request/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ description = """
1414
Yet yet yet another OAuth 1.0 client library.
1515
"""
1616

17+
[package.metadata.docs.rs]
18+
rustdoc-args = ["--cfg", "docsrs"]
19+
1720
[dependencies]
1821
base64 = "0.13"
1922
bitflags = "1"

oauth1-request/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@
8888
//!
8989
//! See [`Request`][oauth1_request_derive::Request] for more details on the derive macro.
9090
91+
#![cfg_attr(docsrs, feature(doc_cfg, doc_cfg_hide))]
9192
#![doc(html_root_url = "https://docs.rs/oauth1-request/0.5.1")]
93+
// Prevent `oauth-credentials/alloc` feature from showing up on re-exports.
94+
#![cfg_attr(docsrs, doc(cfg_hide(feature = "alloc")))]
9295
#![deny(broken_intra_doc_links)]
9396
#![warn(missing_docs, rust_2018_idioms)]
9497

oauth1-request/src/serializer/auth.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,9 @@ options! {
5353
/// A version of `Signer` that uses the `PLAINTEXT` signature method.
5454
pub type PlaintextAuthorizer<'a> = Authorizer<'a, Plaintext>;
5555

56-
cfg_if::cfg_if! {
57-
if #[cfg(feature = "hmac-sha1")] {
58-
use crate::signature_method::HmacSha1;
59-
/// A version of `Signer` that uses the `HMAC-SHA1` signature method.
60-
pub type HmacSha1Authorizer<'a> = Authorizer<'a, HmacSha1>;
61-
}
62-
}
56+
/// A version of `Signer` that uses the `HMAC-SHA1` signature method.
57+
#[cfg(feature = "hmac-sha1")]
58+
pub type HmacSha1Authorizer<'a> = Authorizer<'a, crate::signature_method::HmacSha1>;
6359

6460
impl<'a, SM: SignatureMethod> Authorizer<'a, SM> {
6561
/// Creates an `Authorizer`.

oauth1-request/src/signature_method.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@
66
//! So the module provides an abstraction over signature methods so that users can implement those
77
//! custom methods by themselves.
88
9-
cfg_if::cfg_if! {
10-
if #[cfg(feature = "hmac-sha1")] {
11-
pub mod hmac_sha1;
12-
pub use self::hmac_sha1::HmacSha1;
13-
}
14-
}
15-
9+
#[cfg(feature = "hmac-sha1")]
10+
pub mod hmac_sha1;
1611
pub mod identity;
1712
pub mod plaintext;
1813

1914
#[cfg(feature = "either")]
2015
mod either;
2116

17+
#[cfg(feature = "hmac-sha1")]
18+
pub use self::hmac_sha1::HmacSha1;
2219
pub use self::identity::Identity;
2320
pub use self::plaintext::Plaintext;
2421

0 commit comments

Comments
 (0)