From a2b45b3363ddf31efcd4920462d6ec3e0ef9a909 Mon Sep 17 00:00:00 2001 From: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> Date: Fri, 12 May 2023 22:18:57 +0200 Subject: [PATCH] fix(docs): Change `dir` and `file` variable names to match existing comments and rest of module (#237) --- src/dir.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/dir.rs b/src/dir.rs index 917e47ec2..483b6d807 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -45,16 +45,16 @@ use crate::Builder; /// # } /// # fn run() -> Result<(), io::Error> { /// // Create a directory inside of `std::env::temp_dir()` -/// let dir = tempdir()?; +/// let tmp_dir = tempdir()?; /// -/// let file_path = dir.path().join("my-temporary-note.txt"); -/// let mut file = File::create(file_path)?; -/// writeln!(file, "Brian was here. Briefly.")?; +/// let file_path = tmp_dir.path().join("my-temporary-note.txt"); +/// let mut tmp_file = File::create(file_path)?; +/// writeln!(tmp_file, "Brian was here. Briefly.")?; /// /// // `tmp_dir` goes out of scope, the directory as well as /// // `tmp_file` will be deleted here. -/// drop(file); -/// dir.close()?; +/// drop(tmp_file); +/// tmp_dir.close()?; /// # Ok(()) /// # } /// ``` @@ -94,16 +94,16 @@ pub fn tempdir() -> io::Result { /// # } /// # fn run() -> Result<(), io::Error> { /// // Create a directory inside of the current directory. -/// let dir = tempdir_in(".")?; +/// let tmp_dir = tempdir_in(".")?; /// -/// let file_path = dir.path().join("my-temporary-note.txt"); -/// let mut file = File::create(file_path)?; -/// writeln!(file, "Brian was here. Briefly.")?; +/// let file_path = tmp_dir.path().join("my-temporary-note.txt"); +/// let mut tmp_file = File::create(file_path)?; +/// writeln!(tmp_file, "Brian was here. Briefly.")?; /// /// // `tmp_dir` goes out of scope, the directory as well as /// // `tmp_file` will be deleted here. -/// drop(file); -/// dir.close()?; +/// drop(tmp_file); +/// tmp_dir.close()?; /// # Ok(()) /// # } /// ```