@@ -156,12 +156,14 @@ pub struct DirBuilder {
156156impl File {
157157 /// Attempts to open a file in read-only mode.
158158 ///
159- /// See the `OpenOptions::open` method for more details.
159+ /// See the [ `OpenOptions::open`] method for more details.
160160 ///
161161 /// # Errors
162162 ///
163163 /// This function will return an error if `path` does not already exist.
164- /// Other errors may also be returned according to `OpenOptions::open`.
164+ /// Other errors may also be returned according to [`OpenOptions::open`].
165+ ///
166+ /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
165167 ///
166168 /// # Examples
167169 ///
@@ -183,7 +185,9 @@ impl File {
183185 /// This function will create a file if it does not exist,
184186 /// and will truncate it if it does.
185187 ///
186- /// See the `OpenOptions::open` function for more details.
188+ /// See the [`OpenOptions::open`] function for more details.
189+ ///
190+ /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open
187191 ///
188192 /// # Examples
189193 ///
@@ -224,15 +228,17 @@ impl File {
224228 self . inner . fsync ( )
225229 }
226230
227- /// This function is similar to `sync_all`, except that it may not
231+ /// This function is similar to [ `sync_all`] , except that it may not
228232 /// synchronize file metadata to the filesystem.
229233 ///
230234 /// This is intended for use cases that must synchronize content, but don't
231235 /// need the metadata on disk. The goal of this method is to reduce disk
232236 /// operations.
233237 ///
234238 /// Note that some platforms may simply implement this in terms of
235- /// `sync_all`.
239+ /// [`sync_all`].
240+ ///
241+ /// [`sync_all`]: struct.File.html#method.sync_all
236242 ///
237243 /// # Examples
238244 ///
@@ -304,6 +310,18 @@ impl File {
304310 /// The returned `File` is a reference to the same state that this object
305311 /// references. Both handles will read and write with the same cursor
306312 /// position.
313+ ///
314+ /// # Examples
315+ ///
316+ /// ```no_run
317+ /// use std::fs::File;
318+ ///
319+ /// # fn foo() -> std::io::Result<()> {
320+ /// let mut f = try!(File::open("foo.txt"));
321+ /// let file_copy = try!(f.try_clone());
322+ /// # Ok(())
323+ /// # }
324+ /// ```
307325 #[ stable( feature = "file_try_clone" , since = "1.9.0" ) ]
308326 pub fn try_clone ( & self ) -> io:: Result < File > {
309327 Ok ( File {
0 commit comments