Skip to content

Commit 2699de6

Browse files
authored
Rollup merge of rust-lang#129963 - rjooske:fix/inaccurate_to_string_lossy_doc, r=workingjubilee
Inaccurate `{Path,OsStr}::to_string_lossy()` documentation The documentation of `Path::to_string_lossy()` and `OsStr::to_string_lossy()` says the following: > Any non-Unicode sequences are replaced with `U+FFFD REPLACEMENT CHARACTER` which didn't immediately make sense to me. ("non-Unicode sequences"?) Since both `to_string_lossy` functions eventually become just a call to `String::from_utf8_lossy`, I believe the documentation meant to say: > Any *non-UTF-8* sequences are replaced with `U+FFFD REPLACEMENT CHARACTER` This PR corrects this mistake in the documentation. For the record, a similar quote can be found in the documentation of `String::from_utf8_lossy`: > ... During this conversion, `from_utf8_lossy()` will replace any invalid UTF-8 sequences with `U+FFFD REPLACEMENT CHARACTER`, ...
2 parents cde8145 + eb47468 commit 2699de6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

std/src/ffi/os_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ impl OsStr {
852852

853853
/// Converts an `OsStr` to a <code>[Cow]<[str]></code>.
854854
///
855-
/// Any non-Unicode sequences are replaced with
855+
/// Any non-UTF-8 sequences are replaced with
856856
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
857857
///
858858
/// [U+FFFD]: crate::char::REPLACEMENT_CHARACTER

std/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ impl Path {
22002200

22012201
/// Converts a `Path` to a [`Cow<str>`].
22022202
///
2203-
/// Any non-Unicode sequences are replaced with
2203+
/// Any non-UTF-8 sequences are replaced with
22042204
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
22052205
///
22062206
/// [U+FFFD]: super::char::REPLACEMENT_CHARACTER

0 commit comments

Comments
 (0)