Skip to content

Commit 5ebdf3d

Browse files
committed
fix example for path.rs
1 parent e0065e7 commit 5ebdf3d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/src/path.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ static TILDE: Lazy<&OsStr> = Lazy::new(|| OsStr::new("~"));
4848
/// # Examples
4949
///
5050
/// ```
51-
/// use lib::path::ExtendedPath
51+
/// use lib::path::{ExtendedPath, PathError};
52+
/// use std::path::Path;
5253
///
53-
/// let path = path::Path("./example/../example.txt");
54-
/// let cleaned_path = path.clean();
55-
/// println!("cleaned path: {}", cleaned_path);
54+
/// fn main() -> Result<(), PathError> {
55+
/// let path = Path::new("./src/../Cargo.toml");
56+
/// let cleaned_path = path.clean()?;
57+
/// println!("cleaned path: {:?}", cleaned_path);
5658
///
57-
/// let path = path::Path("~/example.txt");
58-
/// let expanded_path = path.expand_env();
59-
/// println!("expanded env path: {}", expanded_path);
59+
/// let path = Path::new("~/.cargo");
60+
/// let expanded_path = path.expand_env()?;
61+
/// println!("expanded env path: {:?}", expanded_path);
62+
/// Ok(())
63+
/// }
6064
/// ```
6165
pub trait ExtendedPath {
6266
fn clean(&self) -> Result<PathBuf, PathError>;

0 commit comments

Comments
 (0)