Skip to content

Commit 656d2a3

Browse files
committed
Use From/Into rather than the traits they replaced.
1 parent 89544e9 commit 656d2a3

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

library/std/src/os/fd/raw.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use crate::os::raw;
88
#[cfg(unix)]
99
use crate::os::unix::io::OwnedFd;
1010
#[cfg(all(doc, unix))]
11-
use crate::os::unix::io::{AsFd, FromFd, IntoFd};
11+
use crate::os::unix::io::AsFd;
1212
#[cfg(all(doc, target_os = "wasi"))]
13-
use crate::os::unix::io::{AsFd, FromFd, IntoFd};
13+
use crate::os::unix::io::AsFd;
1414
#[cfg(target_os = "wasi")]
1515
use crate::os::wasi::io::OwnedFd;
1616
use crate::sys_common::{AsInner, IntoInner};
@@ -69,8 +69,9 @@ pub trait FromRawFd {
6969
/// will take responsibility for closing it when the object goes out of
7070
/// scope.
7171
///
72-
/// However, consuming ownership is not strictly required. See
73-
/// [`FromFd::from_fd`] for an API which strictly consumes ownership.
72+
/// However, consuming ownership is not strictly required. Use a
73+
/// [`From<OwnedFd>::from`] implementation for an API which strictly
74+
/// consumes ownership.
7475
///
7576
/// # Safety
7677
///
@@ -109,8 +110,9 @@ pub trait IntoRawFd {
109110
/// file descriptor to the caller. When used in this way, callers are then the unique
110111
/// owners of the file descriptor and must close it once it's no longer needed.
111112
///
112-
/// However, transferring ownership is not strictly required. See
113-
/// [`IntoFd::into_fd`] for an API which strictly transfers ownership.
113+
/// However, transferring ownership is not strictly required. Use a
114+
/// [`Into<OwnedFd>::into`] implementation for an API which strictly
115+
/// transfers ownership.
114116
///
115117
/// # Example
116118
///

library/std/src/os/windows/io/raw.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::fs;
66
use crate::io;
77
use crate::net;
88
#[cfg(doc)]
9-
use crate::os::windows::io::{AsHandle, AsSocket, FromHandle, FromSocket, IntoHandle, IntoSocket};
9+
use crate::os::windows::io::{AsHandle, AsSocket};
1010
use crate::os::windows::io::{OwnedHandle, OwnedSocket};
1111
use crate::os::windows::raw;
1212
use crate::sys;
@@ -48,8 +48,9 @@ pub trait FromRawHandle {
4848
/// will take responsibility for closing it when the object goes out of
4949
/// scope.
5050
///
51-
/// However, consuming ownership is not strictly required. See
52-
/// [`FromHandle::from_handle`] for an API which strictly consumes ownership.
51+
/// However, consuming ownership is not strictly required. Use a
52+
/// `From<OwnedHandle>::from` implementation for an API which strictly
53+
/// consumes ownership.
5354
///
5455
/// # Safety
5556
///
@@ -79,8 +80,9 @@ pub trait IntoRawHandle {
7980
/// handle to the caller. When used in this way, callers are then the unique
8081
/// owners of the handle and must close it once it's no longer needed.
8182
///
82-
/// However, transferring ownership is not strictly required. See
83-
/// [`IntoHandle::into_handle`] for an API which strictly transfers ownership.
83+
/// However, transferring ownership is not strictly required. Use a
84+
/// `Into<OwnedHandle>::into` implementation for an API which strictly
85+
/// transfers ownership.
8486
#[stable(feature = "into_raw_os", since = "1.4.0")]
8587
fn into_raw_handle(self) -> RawHandle;
8688
}
@@ -181,8 +183,9 @@ pub trait FromRawSocket {
181183
/// will take responsibility for closing it when the object goes out of
182184
/// scope.
183185
///
184-
/// However, consuming ownership is not strictly required. See
185-
/// [`FromSocket::from_socket`] for an API which strictly consumes ownership.
186+
/// However, consuming ownership is not strictly required. Use a
187+
/// `From<OwnedSocket>::from` implementation for an API which strictly
188+
/// consumes ownership.
186189
///
187190
/// # Safety
188191
///
@@ -205,8 +208,9 @@ pub trait IntoRawSocket {
205208
/// socket to the caller. When used in this way, callers are then the unique
206209
/// owners of the socket and must close it once it's no longer needed.
207210
///
208-
/// However, transferring ownership is not strictly required. See
209-
/// [`IntoSocket::into_socket`] for an API which strictly transfers ownership.
211+
/// However, transferring ownership is not strictly required. Use a
212+
/// `Into<OwnedSocket>::into` implementation for an API which strictly
213+
/// transfers ownership.
210214
#[stable(feature = "into_raw_os", since = "1.4.0")]
211215
fn into_raw_socket(self) -> RawSocket;
212216
}

0 commit comments

Comments
 (0)