Skip to content

Commit

Permalink
Bring pre-revert code up to clippy standards
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Jan 9, 2023
1 parent 1692223 commit 65de6df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tempfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ impl TempFile {

let raw_fname = CString::new(os_fname.into_vec()).unwrap().into_raw();

// Safe because I'm sure `raw_fname` is a valid CString.
// SAFETY: Safe because I'm sure `raw_fname` is a valid CString.
let fd = unsafe { libc::mkstemp(raw_fname) };

// The `raw_fname` is the same as `os_fname` (which is `prefix` with X's
// SAFETY: The `raw_fname` is the same as `os_fname` (which is `prefix` with X's
// appended). The X's are documented as "six characters" which seem to
// always be alphanumerics so appears safe.
let c_tempname = unsafe { CString::from_raw(raw_fname) };
Expand All @@ -74,7 +74,7 @@ impl TempFile {
return errno_result();
}

// Safe because we checked `fd != -1` above and we uniquely own the file
// SAFETY: Safe because we checked `fd != -1` above and we uniquely own the file
// descriptor. This `fd` will be freed etc when `File` and thus
// `TempFile` goes out of scope.
let file = unsafe { File::from_raw_fd(fd) };
Expand Down

0 comments on commit 65de6df

Please sign in to comment.