From 1230a08679e70b8d9a9ce653f8663ff27832db54 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Thu, 14 Jan 2016 16:59:28 +0100 Subject: [PATCH] Fix doctests --- src/libstd/fs.rs | 1 + src/libstd/sys/unix/ext/fs.rs | 5 +++-- src/libstd/sys/windows/ext/fs.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 6a96ab56fc3..fcaa2fede2e 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -515,6 +515,7 @@ pub fn create(&mut self, create: bool) -> &mut OpenOptions { /// # Examples /// /// ```no_run + /// #![feature(expand_open_options)] /// use std::fs::OpenOptions; /// /// let file = OpenOptions::new().write(true).create_new(true).open("foo.txt"); diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 75ea5846fb3..33f29d44f87 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -114,12 +114,13 @@ pub trait OpenOptionsExt { /// /// # Examples /// - /// ```no_run + /// ```rust,ignore /// extern crate libc; /// use std::fs::OpenOptions; /// use std::os::unix::fs::OpenOptionsExt; /// - /// let options = OpenOptions::new().write(true); + /// let mut options = OpenOptions::new(); + /// options.write(true); /// if cfg!(unix) { options.custom_flags(libc::O_NOFOLLOW); } /// let file = options.open("foo.txt"); /// ``` diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 04053b6cb6a..4bb67b0fad9 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -77,7 +77,8 @@ pub trait OpenOptionsExt { /// use std::fs::OpenOptions; /// use std::os::windows::fs::OpenOptionsExt; /// - /// let options = OpenOptions::new().create(true).write(true); + /// let mut options = OpenOptions::new(); + /// options.create(true).write(true); /// if cfg!(windows) { options.custom_flags(winapi::FILE_FLAG_DELETE_ON_CLOSE); } /// let file = options.open("foo.txt"); /// ``` -- 2.44.0