Unnamed repository; edit this file 'description' to name the repository.
Document crate feature guards
Rob Ede 2024-06-01
parent 7cb89f1 · commit 5146c92
-rw-r--r--lib/smol_str/Cargo.toml6
-rw-r--r--lib/smol_str/src/lib.rs4
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/smol_str/Cargo.toml b/lib/smol_str/Cargo.toml
index dcefb03231..b04a6f8e5b 100644
--- a/lib/smol_str/Cargo.toml
+++ b/lib/smol_str/Cargo.toml
@@ -7,8 +7,12 @@ repository = "https://github.com/rust-analyzer/smol_str"
authors = ["Aleksey Kladov <[email protected]>"]
edition = "2018"
+[package.metadata.docs.rs]
+rustdoc-args = ["--cfg", "docsrs"]
+all-features = true
+
[dependencies]
-serde = { version = "1.0.136", optional = true, default_features = false }
+serde = { version = "1.0.136", optional = true, default-features = false }
arbitrary = { version = "1.1.0", optional = true }
[dev-dependencies]
diff --git a/lib/smol_str/src/lib.rs b/lib/smol_str/src/lib.rs
index 78c4e9a74e..f49cfbfe40 100644
--- a/lib/smol_str/src/lib.rs
+++ b/lib/smol_str/src/lib.rs
@@ -1,4 +1,6 @@
#![no_std]
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
extern crate alloc;
use alloc::{borrow::Cow, boxed::Box, string::String, sync::Arc};
@@ -21,7 +23,7 @@ use core::{
/// * Longer than 23 bytes, but substrings of `WS` (see below). Such strings consist
/// solely of consecutive newlines, followed by consecutive spaces
/// * If a string does not satisfy the aforementioned conditions, it is heap-allocated
-/// * Additionally, a `SmolStr` can be explicitely created from a `&'static str` without allocation
+/// * Additionally, a `SmolStr` can be explicitly created from a `&'static str` without allocation
///
/// Unlike `String`, however, `SmolStr` is immutable. The primary use case for
/// `SmolStr` is a good enough default storage for tokens of typical programming