diff options
| author | Ben Schulz <benschulz@users.noreply.github.com> | 2025-02-07 20:36:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 20:36:32 +0100 |
| commit | 8ea20c82bbb5ac7040fe8dab326849a47f851c97 (patch) | |
| tree | a25c12015f27fbf9cf4508f31aa72bbe152345ae | |
| parent | 64e06c0f5578829373743884b708d494136c3e8f (diff) | |
| download | rust-8ea20c82bbb5ac7040fe8dab326849a47f851c97.tar.gz rust-8ea20c82bbb5ac7040fe8dab326849a47f851c97.zip | |
Improve examples for file locking
| -rw-r--r-- | library/std/src/fs.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index a5b0111adfb..9e9e8ddb3c0 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -664,7 +664,7 @@ impl File { /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { - /// let f = File::open("foo.txt")?; + /// let f = File::create("foo.txt")?; /// f.lock()?; /// Ok(()) /// } @@ -767,7 +767,7 @@ impl File { /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { - /// let f = File::open("foo.txt")?; + /// let f = File::create("foo.txt")?; /// f.try_lock()?; /// Ok(()) /// } |
