]> git.lizzy.rs Git - rust.git/commit
Fix up docs for String::from_utf8_lossy()
authorSteve Klabnik <steve@steveklabnik.com>
Mon, 8 Feb 2016 22:10:55 +0000 (17:10 -0500)
committerSteve Klabnik <steve@steveklabnik.com>
Mon, 8 Feb 2016 22:10:55 +0000 (17:10 -0500)
commit5089b43b4560043150b88e6de1ee98eabf0bf11d
tree07e646aadf1a1a8dcafb0bfb4a906e118f843f54
parentefdde2479b3099b35b38a7445b5f09559e3f1fd0
Fix up docs for String::from_utf8_lossy()

When I last did a pass through the string documentation, I focused on
consistency across similar functions. Unfortunately, I missed some
details. This example was _too_ consistent: it wasn't actually accurate!

This commit fixes the docs do both be more accurate and to explain why
the return type is a Cow<'a, str>.

First reported here:
https://www.reddit.com/r/rust/comments/44q9ms/stringfrom_utf8_lossy_doesnt_return_a_string/
src/libcollections/string.rs