about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-08-05 15:09:33 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-08-05 15:09:33 -0700
commit1bb14a8bb79a7dda67d678209b1b731ee1a781b9 (patch)
tree03996c7b2fff2bb411a02cdcd817f759a98cb023 /library/std/src
parentec7c02612527d185c379900b613311bc1dcbf7dc (diff)
downloadrust-1bb14a8bb79a7dda67d678209b1b731ee1a781b9.tar.gz
rust-1bb14a8bb79a7dda67d678209b1b731ee1a781b9.zip
`File::set_times`: Remove `write(true)` from the example so it works on directories
Inspired by https://github.com/rust-lang/rust/issues/123883 .
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/fs.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index 72ad7c244ee..08976ae668e 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -1128,7 +1128,7 @@ impl File {
     ///     use std::fs::{self, File, FileTimes};
     ///
     ///     let src = fs::metadata("src")?;
-    ///     let dest = File::options().write(true).open("dest")?;
+    ///     let dest = File::open("dest")?;
     ///     let times = FileTimes::new()
     ///         .set_accessed(src.accessed()?)
     ///         .set_modified(src.modified()?);