diff options
| author | Dan Gohman <dev@sunfishcode.online> | 2022-02-01 14:57:31 -0800 |
|---|---|---|
| committer | Dan Gohman <dev@sunfishcode.online> | 2022-02-01 14:58:11 -0800 |
| commit | 656d2a3a12746d624b8ee9dada8a70d708e1526c (patch) | |
| tree | d8220901785eb473b656be11d11ee9bb26f47c08 | |
| parent | 89544e900125aed4899706c78e8bbce5cb5f1023 (diff) | |
| download | rust-656d2a3a12746d624b8ee9dada8a70d708e1526c.tar.gz rust-656d2a3a12746d624b8ee9dada8a70d708e1526c.zip | |
Use `From`/`Into` rather than the traits they replaced.
| -rw-r--r-- | library/std/src/os/fd/raw.rs | 14 | ||||
| -rw-r--r-- | library/std/src/os/windows/io/raw.rs | 22 |
2 files changed, 21 insertions, 15 deletions
diff --git a/library/std/src/os/fd/raw.rs b/library/std/src/os/fd/raw.rs index bc3007da86a..6feea737f3b 100644 --- a/library/std/src/os/fd/raw.rs +++ b/library/std/src/os/fd/raw.rs @@ -8,9 +8,9 @@ use crate::os::raw; #[cfg(unix)] use crate::os::unix::io::OwnedFd; #[cfg(all(doc, unix))] -use crate::os::unix::io::{AsFd, FromFd, IntoFd}; +use crate::os::unix::io::AsFd; #[cfg(all(doc, target_os = "wasi"))] -use crate::os::unix::io::{AsFd, FromFd, IntoFd}; +use crate::os::unix::io::AsFd; #[cfg(target_os = "wasi")] use crate::os::wasi::io::OwnedFd; use crate::sys_common::{AsInner, IntoInner}; @@ -69,8 +69,9 @@ pub trait FromRawFd { /// will take responsibility for closing it when the object goes out of /// scope. /// - /// However, consuming ownership is not strictly required. See - /// [`FromFd::from_fd`] for an API which strictly consumes ownership. + /// However, consuming ownership is not strictly required. Use a + /// [`From<OwnedFd>::from`] implementation for an API which strictly + /// consumes ownership. /// /// # Safety /// @@ -109,8 +110,9 @@ pub trait IntoRawFd { /// file descriptor to the caller. When used in this way, callers are then the unique /// owners of the file descriptor and must close it once it's no longer needed. /// - /// However, transferring ownership is not strictly required. See - /// [`IntoFd::into_fd`] for an API which strictly transfers ownership. + /// However, transferring ownership is not strictly required. Use a + /// [`Into<OwnedFd>::into`] implementation for an API which strictly + /// transfers ownership. /// /// # Example /// diff --git a/library/std/src/os/windows/io/raw.rs b/library/std/src/os/windows/io/raw.rs index 285802c6a9e..dc84a38156a 100644 --- a/library/std/src/os/windows/io/raw.rs +++ b/library/std/src/os/windows/io/raw.rs @@ -6,7 +6,7 @@ use crate::fs; use crate::io; use crate::net; #[cfg(doc)] -use crate::os::windows::io::{AsHandle, AsSocket, FromHandle, FromSocket, IntoHandle, IntoSocket}; +use crate::os::windows::io::{AsHandle, AsSocket}; use crate::os::windows::io::{OwnedHandle, OwnedSocket}; use crate::os::windows::raw; use crate::sys; @@ -48,8 +48,9 @@ pub trait FromRawHandle { /// will take responsibility for closing it when the object goes out of /// scope. /// - /// However, consuming ownership is not strictly required. See - /// [`FromHandle::from_handle`] for an API which strictly consumes ownership. + /// However, consuming ownership is not strictly required. Use a + /// `From<OwnedHandle>::from` implementation for an API which strictly + /// consumes ownership. /// /// # Safety /// @@ -79,8 +80,9 @@ pub trait IntoRawHandle { /// handle to the caller. When used in this way, callers are then the unique /// owners of the handle and must close it once it's no longer needed. /// - /// However, transferring ownership is not strictly required. See - /// [`IntoHandle::into_handle`] for an API which strictly transfers ownership. + /// However, transferring ownership is not strictly required. Use a + /// `Into<OwnedHandle>::into` implementation for an API which strictly + /// transfers ownership. #[stable(feature = "into_raw_os", since = "1.4.0")] fn into_raw_handle(self) -> RawHandle; } @@ -181,8 +183,9 @@ pub trait FromRawSocket { /// will take responsibility for closing it when the object goes out of /// scope. /// - /// However, consuming ownership is not strictly required. See - /// [`FromSocket::from_socket`] for an API which strictly consumes ownership. + /// However, consuming ownership is not strictly required. Use a + /// `From<OwnedSocket>::from` implementation for an API which strictly + /// consumes ownership. /// /// # Safety /// @@ -205,8 +208,9 @@ pub trait IntoRawSocket { /// socket to the caller. When used in this way, callers are then the unique /// owners of the socket and must close it once it's no longer needed. /// - /// However, transferring ownership is not strictly required. See - /// [`IntoSocket::into_socket`] for an API which strictly transfers ownership. + /// However, transferring ownership is not strictly required. Use a + /// `Into<OwnedSocket>::into` implementation for an API which strictly + /// transfers ownership. #[stable(feature = "into_raw_os", since = "1.4.0")] fn into_raw_socket(self) -> RawSocket; } |
