Skip to content

Commit

Permalink
Bring documentation of Path::to_path_buf in line with the rest of Pat…
Browse files Browse the repository at this point in the history
…h/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.
  • Loading branch information
Kriskras99 authored Apr 10, 2024
1 parent b14d8b2 commit bc8ad6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2143,10 +2143,10 @@ impl Path {
/// # 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, \
Expand Down

0 comments on commit bc8ad6a

Please sign in to comment.