Rollup merge of #78163 - camelid:fixup-lib-docs, r=m-ou-se
Clean up lib docs Cherry-picked out of #78094.
This commit is contained in:
commit
dfb0d09bae
@ -1,8 +1,8 @@
|
|||||||
//! A UTF-8 encoded, growable string.
|
//! A UTF-8–encoded, growable string.
|
||||||
//!
|
//!
|
||||||
//! This module contains the [`String`] type, a trait for converting
|
//! This module contains the [`String`] type, the [`ToString`] trait for
|
||||||
//! [`ToString`]s, and several error types that may result from working with
|
//! converting to strings, and several error types that may result from
|
||||||
//! [`String`]s.
|
//! working with [`String`]s.
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
@ -57,7 +57,7 @@ use crate::collections::TryReserveError;
|
|||||||
use crate::str::{self, from_boxed_utf8_unchecked, Chars, FromStr, Utf8Error};
|
use crate::str::{self, from_boxed_utf8_unchecked, Chars, FromStr, Utf8Error};
|
||||||
use crate::vec::Vec;
|
use crate::vec::Vec;
|
||||||
|
|
||||||
/// A UTF-8 encoded, growable string.
|
/// A UTF-8–encoded, growable string.
|
||||||
///
|
///
|
||||||
/// The `String` type is the most common string type that has ownership over the
|
/// The `String` type is the most common string type that has ownership over the
|
||||||
/// contents of the string. It has a close relationship with its borrowed
|
/// contents of the string. It has a close relationship with its borrowed
|
||||||
@ -565,7 +565,7 @@ impl String {
|
|||||||
Cow::Owned(res)
|
Cow::Owned(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decode a UTF-16 encoded vector `v` into a `String`, returning [`Err`]
|
/// Decode a UTF-16–encoded vector `v` into a `String`, returning [`Err`]
|
||||||
/// if `v` contains any invalid data.
|
/// if `v` contains any invalid data.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
@ -599,7 +599,7 @@ impl String {
|
|||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decode a UTF-16 encoded slice `v` into a `String`, replacing
|
/// Decode a UTF-16–encoded slice `v` into a `String`, replacing
|
||||||
/// invalid data with [the replacement character (`U+FFFD`)][U+FFFD].
|
/// invalid data with [the replacement character (`U+FFFD`)][U+FFFD].
|
||||||
///
|
///
|
||||||
/// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
|
/// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
|
||||||
@ -2191,8 +2191,9 @@ pub trait ToString {
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<T: fmt::Display + ?Sized> ToString for T {
|
impl<T: fmt::Display + ?Sized> ToString for T {
|
||||||
// A common guideline is to not inline generic functions. However,
|
// A common guideline is to not inline generic functions. However,
|
||||||
// remove `#[inline]` from this method causes non-negligible regression.
|
// removing `#[inline]` from this method causes non-negligible regressions.
|
||||||
// See <https://github.com/rust-lang/rust/pull/74852> as last attempt try to remove it.
|
// See <https://github.com/rust-lang/rust/pull/74852>, the last attempt
|
||||||
|
// to try to remove it.
|
||||||
#[inline]
|
#[inline]
|
||||||
default fn to_string(&self) -> String {
|
default fn to_string(&self) -> String {
|
||||||
use fmt::Write;
|
use fmt::Write;
|
||||||
|
Loading…
Reference in New Issue
Block a user