Skip to content

Commit

Permalink
Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514
Browse files Browse the repository at this point in the history
Clarify that String::split_at takes a byte index.

To someone skimming through the `String` docs and only reads the first line, the person could interpret "index" to be "char index". Later on in the docs it clarifies, but by adding "byte" it removes that ambiguity.
  • Loading branch information
tmandry committed Dec 11, 2020
2 parents 8709ac8 + 33ae62c commit c0cc910
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ impl String {
self.len() == 0
}

/// Splits the string into two at the given index.
/// Splits the string into two at the given byte index.
///
/// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
/// the returned `String` contains bytes `[at, len)`. `at` must be on the
Expand Down

0 comments on commit c0cc910

Please sign in to comment.