@@ -40,7 +40,7 @@ pub trait FileExt {
4040 ///
4141 /// # Examples
4242 ///
43- /// ```
43+ /// ```no_run
4444 /// use std::io;
4545 /// use std::fs::File;
4646 /// use std::os::windows::prelude::*;
@@ -75,7 +75,7 @@ pub trait FileExt {
7575 ///
7676 /// # Examples
7777 ///
78- /// ```
78+ /// ```no_run
7979 /// use std::fs::File;
8080 /// use std::os::windows::prelude::*;
8181 ///
@@ -120,10 +120,10 @@ pub trait OpenOptionsExt {
120120 ///
121121 /// ```no_run
122122 /// use std::fs::OpenOptions;
123- /// use std::os::windows::fs::OpenOptionsExt ;
123+ /// use std::os::windows::prelude::* ;
124124 ///
125125 /// // Open without read and write permission, for example if you only need
126- /// // to call `stat() ` on the file
126+ /// // to call `stat` on the file
127127 /// let file = OpenOptions::new().access_mode(0).open("foo.txt");
128128 /// ```
129129 ///
@@ -145,13 +145,14 @@ pub trait OpenOptionsExt {
145145 ///
146146 /// ```no_run
147147 /// use std::fs::OpenOptions;
148- /// use std::os::windows::fs::OpenOptionsExt ;
148+ /// use std::os::windows::prelude::* ;
149149 ///
150150 /// // Do not allow others to read or modify this file while we have it open
151151 /// // for writing.
152- /// let file = OpenOptions::new().write(true)
153- /// .share_mode(0)
154- /// .open("foo.txt");
152+ /// let file = OpenOptions::new()
153+ /// .write(true)
154+ /// .share_mode(0)
155+ /// .open("foo.txt");
155156 /// ```
156157 ///
157158 /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
@@ -170,13 +171,15 @@ pub trait OpenOptionsExt {
170171 ///
171172 /// ```ignore
172173 /// extern crate winapi;
174+ ///
173175 /// use std::fs::OpenOptions;
174- /// use std::os::windows::fs::OpenOptionsExt ;
176+ /// use std::os::windows::prelude::* ;
175177 ///
176- /// let mut options = OpenOptions::new();
177- /// options.create(true).write(true);
178- /// options.custom_flags(winapi::FILE_FLAG_DELETE_ON_CLOSE);
179- /// let file = options.open("foo.txt");
178+ /// let file = OpenOptions::new()
179+ /// .create(true)
180+ /// .write(true)
181+ /// .custom_flags(winapi::FILE_FLAG_DELETE_ON_CLOSE)
182+ /// .open("foo.txt");
180183 /// ```
181184 ///
182185 /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
@@ -203,12 +206,15 @@ pub trait OpenOptionsExt {
203206 ///
204207 /// ```ignore
205208 /// extern crate winapi;
209+ ///
206210 /// use std::fs::OpenOptions;
207- /// use std::os::windows::fs::OpenOptionsExt ;
211+ /// use std::os::windows::prelude::* ;
208212 ///
209- /// let file = OpenOptions::new().write(true).create(true)
210- /// .attributes(winapi::FILE_ATTRIBUTE_HIDDEN)
211- /// .open("foo.txt");
213+ /// let file = OpenOptions::new()
214+ /// .write(true)
215+ /// .create(true)
216+ /// .attributes(winapi::FILE_ATTRIBUTE_HIDDEN)
217+ /// .open("foo.txt");
212218 /// ```
213219 ///
214220 /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
@@ -226,17 +232,18 @@ pub trait OpenOptionsExt {
226232 ///
227233 /// # Examples
228234 ///
229- /// ```ignore
235+ /// ```no_run
230236 /// use std::fs::OpenOptions;
231- /// use std::os::windows::fs::OpenOptionsExt ;
237+ /// use std::os::windows::prelude::* ;
232238 ///
233- /// let options = OpenOptions::new();
234- /// options.write(true).create(true);
239+ /// let file = OpenOptions::new()
240+ /// .write(true)
241+ /// .create(true)
235242 ///
236- /// // Sets the flag value to `SecurityIdentification`.
237- /// options.security_qos_flags(1);
243+ /// // Sets the flag value to `SecurityIdentification`.
244+ /// options.security_qos_flags(1)
238245 ///
239- /// let file = options .open("foo.txt");
246+ /// .open("foo.txt");
240247 /// ```
241248 ///
242249 /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
@@ -289,15 +296,15 @@ pub trait MetadataExt {
289296 ///
290297 /// # Examples
291298 ///
292- /// ```ignore
299+ /// ```no_run
293300 /// use std::io;
294- /// use std::io::prelude::*;
295- /// use std::fs::File;
301+ /// use std::fs;
296302 /// use std::os::windows::prelude::*;
297303 ///
298304 /// # fn foo() -> io::Result<()> {
299- /// let mut file = File::open("foo.txt")?;
300- /// let attributes = file.file_attributes();
305+ /// let metadata = fs::metadata("foo.txt")?;
306+ /// let attributes = metadata.file_attributes();
307+ /// # Ok(())
301308 /// # }
302309 /// ```
303310 ///
@@ -319,15 +326,15 @@ pub trait MetadataExt {
319326 ///
320327 /// # Examples
321328 ///
322- /// ```ignore
329+ /// ```no_run
323330 /// use std::io;
324- /// use std::io::prelude::*;
325- /// use std::fs::File;
331+ /// use std::fs;
326332 /// use std::os::windows::prelude::*;
327333 ///
328334 /// # fn foo() -> io::Result<()> {
329- /// let mut file = File::open("foo.txt")?;
330- /// let creation_time = file.creation_time();
335+ /// let metadata = fs::metadata("foo.txt")?;
336+ /// let creation_time = metadata.creation_time();
337+ /// # Ok(())
331338 /// # }
332339 /// ```
333340 ///
@@ -354,15 +361,15 @@ pub trait MetadataExt {
354361 ///
355362 /// # Examples
356363 ///
357- /// ```ignore
364+ /// ```no_run
358365 /// use std::io;
359- /// use std::io::prelude::*;
360- /// use std::fs::File;
366+ /// use std::fs;
361367 /// use std::os::windows::prelude::*;
362368 ///
363369 /// # fn foo() -> io::Result<()> {
364- /// let mut file = File::open("foo.txt")?;
365- /// let last_access_time = file.last_access_time();
370+ /// let metadata = fs::metadata("foo.txt")?;
371+ /// let last_access_time = metadata.last_access_time();
372+ /// # Ok(())
366373 /// # }
367374 /// ```
368375 ///
@@ -387,15 +394,15 @@ pub trait MetadataExt {
387394 ///
388395 /// # Examples
389396 ///
390- /// ```ignore
397+ /// ```no_run
391398 /// use std::io;
392- /// use std::io::prelude::*;
393- /// use std::fs::File;
399+ /// use std::fs;
394400 /// use std::os::windows::prelude::*;
395401 ///
396402 /// # fn foo() -> io::Result<()> {
397- /// let mut file = File::open("foo.txt")?;
398- /// let last_write_time = file.last_write_time();
403+ /// let metadata = fs::metadata("foo.txt")?;
404+ /// let last_write_time = metadata.last_write_time();
405+ /// # Ok(())
399406 /// # }
400407 /// ```
401408 ///
@@ -410,15 +417,15 @@ pub trait MetadataExt {
410417 ///
411418 /// # Examples
412419 ///
413- /// ```ignore
420+ /// ```no_run
414421 /// use std::io;
415- /// use std::io::prelude::*;
416- /// use std::fs::File;
422+ /// use std::fs;
417423 /// use std::os::windows::prelude::*;
418424 ///
419425 /// # fn foo() -> io::Result<()> {
420- /// let mut file = File::open("foo.txt")?;
421- /// let file_size = file.file_size();
426+ /// let metadata = fs::metadata("foo.txt")?;
427+ /// let file_size = metadata.file_size();
428+ /// # Ok(())
422429 /// # }
423430 /// ```
424431 #[ stable( feature = "metadata_ext" , since = "1.1.0" ) ]
@@ -441,7 +448,7 @@ impl MetadataExt for Metadata {
441448///
442449/// # Examples
443450///
444- /// ```ignore
451+ /// ```no_run
445452/// use std::os::windows::fs;
446453///
447454/// # fn foo() -> std::io::Result<()> {
@@ -462,7 +469,7 @@ pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q)
462469///
463470/// # Examples
464471///
465- /// ```ignore
472+ /// ```no_run
466473/// use std::os::windows::fs;
467474///
468475/// # fn foo() -> std::io::Result<()> {
0 commit comments