Skip to content

fix docs for inherent str constructors #137126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl str {
/// Basic usage:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a vector
/// let sparkle_heart = vec![240, 159, 146, 150];
Expand All @@ -207,13 +207,13 @@ impl str {
/// let sparkle_heart = str::from_utf8(&sparkle_heart)?;
///
/// assert_eq!("💖", sparkle_heart);
/// # Ok::<_, str::Utf8Error>(())
/// # Ok::<_, std::str::Utf8Error>(())
/// ```
///
/// Incorrect bytes:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // some invalid bytes, in a vector
/// let sparkle_heart = vec![0, 159, 146, 150];
Expand All @@ -227,7 +227,7 @@ impl str {
/// A "stack allocated string":
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a stack-allocated array
/// let sparkle_heart = [240, 159, 146, 150];
Expand All @@ -249,7 +249,7 @@ impl str {
/// Basic usage:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // "Hello, Rust!" as a mutable vector
/// let mut hellorust = vec![72, 101, 108, 108, 111, 44, 32, 82, 117, 115, 116, 33];
Expand All @@ -263,7 +263,7 @@ impl str {
/// Incorrect bytes:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // Some invalid bytes in a mutable vector
/// let mut invalid = vec![128, 223];
Expand Down Expand Up @@ -292,7 +292,7 @@ impl str {
/// Basic usage:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a vector
/// let sparkle_heart = vec![240, 159, 146, 150];
Expand Down Expand Up @@ -321,7 +321,7 @@ impl str {
/// Basic usage:
///
/// ```
/// use std::str;
/// #![feature(inherent_str_constructors)]
///
/// let mut heart = vec![240, 159, 146, 150];
/// let heart = unsafe { str::from_utf8_unchecked_mut(&mut heart) };
Expand Down
Loading