Skip to content

Commit a2b45b3

Browse files
fix(docs): Change dir and file variable names to match existing comments and rest of module (#237)
1 parent f474e6a commit a2b45b3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/dir.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ use crate::Builder;
4545
/// # }
4646
/// # fn run() -> Result<(), io::Error> {
4747
/// // Create a directory inside of `std::env::temp_dir()`
48-
/// let dir = tempdir()?;
48+
/// let tmp_dir = tempdir()?;
4949
///
50-
/// let file_path = dir.path().join("my-temporary-note.txt");
51-
/// let mut file = File::create(file_path)?;
52-
/// writeln!(file, "Brian was here. Briefly.")?;
50+
/// let file_path = tmp_dir.path().join("my-temporary-note.txt");
51+
/// let mut tmp_file = File::create(file_path)?;
52+
/// writeln!(tmp_file, "Brian was here. Briefly.")?;
5353
///
5454
/// // `tmp_dir` goes out of scope, the directory as well as
5555
/// // `tmp_file` will be deleted here.
56-
/// drop(file);
57-
/// dir.close()?;
56+
/// drop(tmp_file);
57+
/// tmp_dir.close()?;
5858
/// # Ok(())
5959
/// # }
6060
/// ```
@@ -94,16 +94,16 @@ pub fn tempdir() -> io::Result<TempDir> {
9494
/// # }
9595
/// # fn run() -> Result<(), io::Error> {
9696
/// // Create a directory inside of the current directory.
97-
/// let dir = tempdir_in(".")?;
97+
/// let tmp_dir = tempdir_in(".")?;
9898
///
99-
/// let file_path = dir.path().join("my-temporary-note.txt");
100-
/// let mut file = File::create(file_path)?;
101-
/// writeln!(file, "Brian was here. Briefly.")?;
99+
/// let file_path = tmp_dir.path().join("my-temporary-note.txt");
100+
/// let mut tmp_file = File::create(file_path)?;
101+
/// writeln!(tmp_file, "Brian was here. Briefly.")?;
102102
///
103103
/// // `tmp_dir` goes out of scope, the directory as well as
104104
/// // `tmp_file` will be deleted here.
105-
/// drop(file);
106-
/// dir.close()?;
105+
/// drop(tmp_file);
106+
/// tmp_dir.close()?;
107107
/// # Ok(())
108108
/// # }
109109
/// ```

0 commit comments

Comments
 (0)