Skip to content

Commit

Permalink
Rollup merge of rust-lang#67985 - dtolnay:cstr, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Remove insignificant notes from CStr documentation

The to_str and to_string_lossy methods contain a note about the behavior possibly changing in the future. But those notes are referring to a distinction that is not observable in the API. Whether or not the UTF-8 check knows the string length ahead of time, these methods require linear time.
  • Loading branch information
JohnTitor authored Jan 8, 2020
2 parents b687461 + 48add54 commit 98a5c7d
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,6 @@ impl CStr {
/// function will return the corresponding [`&str`] slice. Otherwise,
/// it will return an error with details of where UTF-8 validation failed.
///
/// > **Note**: This method is currently implemented to check for validity
/// > after a constant-time cast, but it is planned to alter its definition
/// > in the future to perform the length calculation in addition to the
/// > UTF-8 check whenever this method is called.
///
/// [`&str`]: ../primitive.str.html
///
/// # Examples
Expand Down Expand Up @@ -1220,11 +1215,6 @@ impl CStr {
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
/// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.
///
/// > **Note**: This method is currently implemented to check for validity
/// > after a constant-time cast, but it is planned to alter its definition
/// > in the future to perform the length calculation in addition to the
/// > UTF-8 check whenever this method is called.
///
/// [`Cow`]: ../borrow/enum.Cow.html
/// [`Borrowed`]: ../borrow/enum.Cow.html#variant.Borrowed
/// [`Owned`]: ../borrow/enum.Cow.html#variant.Owned
Expand Down

0 comments on commit 98a5c7d

Please sign in to comment.