Bring documentation of Path::to_path_buf in line with the rest of Path/PathBuf

Changes the example from using the qualified path of PathBuf with an import. This is what's done in all other Path/PathBuf examples and makes the code look a bit cleaner.
This commit is contained in:
Kriskras99 2024-04-10 13:21:26 +02:00 committed by GitHub
parent b14d8b2ef2
commit bc8ad6a41e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2143,10 +2143,10 @@ pub fn to_string_lossy(&self) -> Cow<'_, str> {
/// # Examples
///
/// ```
/// use std::path::Path;
/// use std::path::{Path, PathBuf};
///
/// let path_buf = Path::new("foo.txt").to_path_buf();
/// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
/// assert_eq!(path_buf, PathBuf::from("foo.txt"));
/// ```
#[rustc_conversion_suggestion]
#[must_use = "this returns the result of the operation, \