Apply suggestions from code review

Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
This commit is contained in:
anatawa12 2024-05-06 12:16:31 +09:00 committed by GitHub
parent ab066ae329
commit 81f5175868
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -408,7 +408,9 @@ pub fn create<P: AsRef<Path>>(path: P) -> io::Result<File> {
/// ///
/// This function will create a file if it does not exist, or return an error if it does. This /// This function will create a file if it does not exist, or return an error if it does. This
/// way, if the call succeeds, the file returned is guaranteed to be new. /// way, if the call succeeds, the file returned is guaranteed to be new.
/// If a file exists at the target location before, creating file will fail with [`AlreadyExists`]. /// If a file exists at the target location, creating a new file will fail with [`AlreadyExists`]
/// or another error based on the situation. See [`OpenOptions::open`] for a
/// non-exhaustive list of likely errors.
/// ///
/// This option is useful because it is atomic. Otherwise between checking whether a file /// This option is useful because it is atomic. Otherwise between checking whether a file
/// exists and creating a new one, the file may have been created by another process (a TOCTOU /// exists and creating a new one, the file may have been created by another process (a TOCTOU
@ -1074,7 +1076,9 @@ pub fn create(&mut self, create: bool) -> &mut Self {
/// ///
/// No file is allowed to exist at the target location, also no (dangling) symlink. In this /// No file is allowed to exist at the target location, also no (dangling) symlink. In this
/// way, if the call succeeds, the file returned is guaranteed to be new. /// way, if the call succeeds, the file returned is guaranteed to be new.
/// If a file exists at the target location before, creating file will fail with [`AlreadyExists`]. /// If a file exists at the target location, creating a new file will fail with [`AlreadyExists`]
/// or another error based on the situation. See [`OpenOptions::open`] for a
/// non-exhaustive list of likely errors.
/// ///
/// This option is useful because it is atomic. Otherwise between checking /// This option is useful because it is atomic. Otherwise between checking
/// whether a file exists and creating a new one, the file may have been /// whether a file exists and creating a new one, the file may have been