Skip to content

Commit 8219d77

Browse files
Simplify hazmat feature docs (#1643)
### What Remove `hazmat` feature from doc cfg attributes, keeping only the specific `hazmat-address` and `hazmat-crypto` features in documentation. #### Before <img width="461" height="214" alt="Screenshot 2025-12-15 at 4 05 12 pm" src="https://github.com/user-attachments/assets/3e00c4da-cf53-4b34-924f-b8f913bfc1c5" /> #### After <img width="461" height="214" alt="Screenshot 2025-12-15 at 4 05 58 pm" src="https://github.com/user-attachments/assets/8229806b-22ab-4e76-bd93-aa1f3a57654c" /> ### Why The generic `hazmat` feature is used for compilation gating, but really only exists historically for backwards compatibility and as something used for testing during development of the SDK. Generally folks should use the narrower scoped hazmat features, so showing it in documentation guides folks to do the not best practice, which results in enabling more hazmat APIs than are necessary.
1 parent a359900 commit 8219d77

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

soroban-sdk/src/address.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,7 @@ impl Address {
394394
/// custom Ed25519 signature verification as a form of authentication
395395
/// because the master key may not be configured the signer of the account.
396396
#[cfg(any(test, feature = "hazmat-address"))]
397-
#[cfg_attr(
398-
feature = "docs",
399-
doc(cfg(any(feature = "hazmat", feature = "hazmat-address")))
400-
)]
397+
#[cfg_attr(feature = "docs", doc(cfg(feature = "hazmat-address")))]
401398
pub fn to_payload(&self) -> Option<AddressPayload> {
402399
AddressPayload::from_address(self)
403400
}
@@ -414,10 +411,7 @@ impl Address {
414411
/// custom Ed25519 signature verification as a form of authentication
415412
/// because the master key may not be configured the signer of the account.
416413
#[cfg(any(test, feature = "hazmat-address"))]
417-
#[cfg_attr(
418-
feature = "docs",
419-
doc(cfg(any(feature = "hazmat", feature = "hazmat-address")))
420-
)]
414+
#[cfg_attr(feature = "docs", doc(cfg(feature = "hazmat-address")))]
421415
pub fn from_payload(env: &Env, payload: AddressPayload) -> Address {
422416
payload.to_address(env)
423417
}

soroban-sdk/src/address_payload.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#![cfg(any(test, feature = "hazmat-address"))]
2-
#![cfg_attr(
3-
feature = "docs",
4-
doc(cfg(any(feature = "hazmat", feature = "hazmat-address")))
5-
)]
2+
#![cfg_attr(feature = "docs", doc(cfg(feature = "hazmat-address")))]
63

74
//! Address payload extraction and construction.
85
//!

soroban-sdk/src/crypto.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ impl Crypto {
191191
/// incorrectly can introduce security vulnerabilities. Please use [Crypto] if
192192
/// possible.
193193
#[cfg_attr(any(test, feature = "hazmat-crypto"), visibility::make(pub))]
194-
#[cfg_attr(
195-
feature = "docs",
196-
doc(cfg(any(feature = "hazmat", feature = "hazmat-crypto")))
197-
)]
194+
#[cfg_attr(feature = "docs", doc(cfg(feature = "hazmat-crypto")))]
198195
pub(crate) struct CryptoHazmat {
199196
env: Env,
200197
}

soroban-sdk/src/env.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ impl Env {
334334
/// incorrectly can introduce security vulnerabilities. Use [Crypto] if
335335
/// possible.
336336
#[cfg_attr(any(test, feature = "hazmat-crypto"), visibility::make(pub))]
337-
#[cfg_attr(
338-
feature = "docs",
339-
doc(cfg(any(feature = "hazmat", feature = "hazmat-crypto")))
340-
)]
337+
#[cfg_attr(feature = "docs", doc(cfg(feature = "hazmat-crypto")))]
341338
#[inline(always)]
342339
pub(crate) fn crypto_hazmat(&self) -> crate::crypto::CryptoHazmat {
343340
crate::crypto::CryptoHazmat::new(self)

0 commit comments

Comments
 (0)