8282//!
8383//! # `no_std`
8484//!
85- //! Focaccia is `no_std` compatible. By default, Focaccia builds with its
86- //! **std** feature enabled to implement [`Error`].
87- //!
88- //! When built without the **std** feature, Focaccia does not link to `alloc`.
89- //!
90- //! # Crate features
91- //!
92- //! All features are enabled by default.
93- //!
94- //! - **std** - Enable linking to the [Rust Standard Library]. Enabling this
95- //! feature adds [`Error`] implementations to error types in this crate.
85+ //! Focaccia is `no_std` compatible and only depends on [`core`]. Focaccia does not
86+ //! link to `alloc` in its `no_std` configuration.
9687//!
9788//! # Unicode Version
9889//!
10697//! [Unicode case folding]: https://www.w3.org/International/wiki/Case_folding
10798//! [`Ordering`]: core::cmp::Ordering
10899//! [dotted and dotless I]: https://en.wikipedia.org/wiki/Dotted_and_dotless_I
109- //! [Rust Standard Library]: https://doc.rust-lang.org/stable/std/index.html
110- //! [`Error`]: https://doc.rust-lang.org/stable/std/error/trait.Error.html
111100
112101#![ no_std]
113- #![ doc( html_root_url = "https://docs.rs/focaccia/1.6 .0" ) ]
102+ #![ doc( html_root_url = "https://docs.rs/focaccia/2.0 .0" ) ]
114103
115- #[ cfg( feature = "std" ) ]
104+ #[ cfg( any ( test , doctest ) ) ]
116105extern crate std;
117106
118107use core:: cmp:: Ordering ;
@@ -364,8 +353,7 @@ impl CaseFold {
364353/// Error type for returned when a folding scheme could not be resolved in a
365354/// [`TryFrom`] implementation.
366355///
367- /// When this crate's `std` feature is enabled, `NoSuchCaseFoldingScheme`
368- /// implements [`std::error::Error`].
356+ /// `NoSuchCaseFoldingScheme` implements [`core::error::Error`].
369357///
370358/// # Examples
371359///
@@ -378,8 +366,6 @@ impl CaseFold {
378366/// assert_eq!(CaseFold::try_from(Some("lithuanian")), Ok(CaseFold::Lithuanian));
379367/// assert_eq!(CaseFold::try_from(Some("xxx")), Err(NoSuchCaseFoldingScheme::new()));
380368/// ```
381- ///
382- /// [`std::error::Error`]: https://doc.rust-lang.org/stable/std/error/trait.Error.html
383369#[ derive( Default , Debug , Clone , Copy , Hash , PartialEq , Eq , PartialOrd , Ord ) ]
384370pub struct NoSuchCaseFoldingScheme {
385371 _private : ( ) ,
@@ -407,8 +393,7 @@ impl fmt::Display for NoSuchCaseFoldingScheme {
407393 }
408394}
409395
410- #[ cfg( feature = "std" ) ]
411- impl std:: error:: Error for NoSuchCaseFoldingScheme { }
396+ impl core:: error:: Error for NoSuchCaseFoldingScheme { }
412397
413398impl TryFrom < Option < & str > > for CaseFold {
414399 type Error = NoSuchCaseFoldingScheme ;
@@ -439,9 +424,7 @@ impl TryFrom<Option<&[u8]>> for CaseFold {
439424mod tests {
440425 use core:: cmp:: Ordering ;
441426
442- use crate :: CaseFold ;
443- #[ cfg( feature = "std" ) ]
444- use crate :: NoSuchCaseFoldingScheme ;
427+ use crate :: { CaseFold , NoSuchCaseFoldingScheme } ;
445428
446429 // https://tools.ietf.org/html/draft-josefsson-idn-test-vectors-00#section-4.2
447430 #[ test]
@@ -617,7 +600,6 @@ mod tests {
617600 }
618601
619602 #[ test]
620- #[ cfg( feature = "std" ) ]
621603 fn error_display_is_not_empty ( ) {
622604 use core:: fmt:: Write as _;
623605 use std:: string:: String ;
@@ -628,6 +610,7 @@ mod tests {
628610 assert ! ( !buf. is_empty( ) ) ;
629611 }
630612}
613+
631614// Ensure code blocks in `README.md` compile.
632615//
633616// This module and macro declaration should be kept at the end of the file, in
0 commit comments