@@ -61,7 +61,6 @@ impl<'d> Debug for TempFile<'d> {
6161
6262#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
6363fn new_tempfile_linux ( d : & Dir , anonymous : bool ) -> io:: Result < Option < File > > {
64- use cap_std:: io_lifetimes:: OwnedFd ;
6564 use rustix:: fs:: { Mode , OFlags } ;
6665 // openat's API uses WRONLY. There may be use cases for reading too, so let's
6766 // support it.
@@ -74,15 +73,13 @@ fn new_tempfile_linux(d: &Dir, anonymous: bool) -> io::Result<Option<File>> {
7473 let mode = Mode :: from_raw_mode ( 0o666 ) ;
7574 // Happy path - Linux with O_TMPFILE
7675 match rustix:: fs:: openat ( d, "." , oflags, mode) {
77- Ok ( r) => return Ok ( Some ( File :: from ( OwnedFd :: from ( r ) ) ) ) ,
76+ Ok ( r) => Ok ( Some ( File :: from ( r ) ) ) ,
7877 // See <https://github.com/Stebalien/tempfile/blob/1a40687e06eb656044e3d2dffa1379f04b3ef3fd/src/file/imp/unix.rs#L81>
7978 // TODO: With newer Rust versions, this could be simplied to only write `Err` once.
8079 Err ( rustix:: io:: Errno :: OPNOTSUPP )
8180 | Err ( rustix:: io:: Errno :: ISDIR )
8281 | Err ( rustix:: io:: Errno :: NOENT ) => Ok ( None ) ,
83- Err ( e) => {
84- return Err ( e. into ( ) ) ;
85- }
82+ Err ( e) => Err ( e. into ( ) ) ,
8683 }
8784}
8885
@@ -92,10 +89,10 @@ fn generate_name_in(subdir: &Dir, f: &File) -> io::Result<String> {
9289 use rustix:: fd:: AsFd ;
9390 use rustix:: fs:: AtFlags ;
9491 let procself_fd = rustix:: io:: proc_self_fd ( ) ?;
95- let fdnum = rustix:: path:: DecInt :: from_fd ( & f. as_fd ( ) ) ;
92+ let fdnum = rustix:: path:: DecInt :: from_fd ( f. as_fd ( ) ) ;
9693 let fdnum = fdnum. as_c_str ( ) ;
9794 super :: retry_with_name_ignoring ( io:: ErrorKind :: AlreadyExists , |name| {
98- rustix:: fs:: linkat ( & procself_fd, fdnum, subdir, name, AtFlags :: SYMLINK_FOLLOW )
95+ rustix:: fs:: linkat ( procself_fd, fdnum, subdir, name, AtFlags :: SYMLINK_FOLLOW )
9996 . map_err ( Into :: into)
10097 } )
10198 . map ( |( _, name) | name)
0 commit comments