Skip to content

Commit fbebb21

Browse files
1860: Nuke deprecated Errno flags r=rtzoeller a=SUPERCILEX `@rtzoeller` It's been quite a few releases since these have been deprecated, more bloat removal. Co-authored-by: Alex Saveau <[email protected]>
2 parents 126112c + 9374e60 commit fbebb21

File tree

2 files changed

+4
-154
lines changed

2 files changed

+4
-154
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
4848

4949
### Removed
5050

51+
- Removed deprecated error constants and conversions.
52+
([#1860](https://github.com/nix-rust/nix/pull/1860))
53+
5154
## [0.25.0] - 2022-08-13
5255
### Added
5356

src/errno.rs

+1-154
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Error, Result};
1+
use crate::Result;
22
use cfg_if::cfg_if;
33
use libc::{c_int, c_void};
44
use std::convert::TryFrom;
@@ -51,34 +51,6 @@ pub fn errno() -> i32 {
5151
}
5252

5353
impl Errno {
54-
/// Convert this `Error` to an [`Errno`](enum.Errno.html).
55-
///
56-
/// # Example
57-
///
58-
/// ```
59-
/// # use nix::Error;
60-
/// # use nix::errno::Errno;
61-
/// let e = Error::from(Errno::EPERM);
62-
/// assert_eq!(Some(Errno::EPERM), e.as_errno());
63-
/// ```
64-
#[deprecated(since = "0.22.0", note = "It's a no-op now; just delete it.")]
65-
pub const fn as_errno(self) -> Option<Self> {
66-
Some(self)
67-
}
68-
69-
/// Create a nix Error from a given errno
70-
#[deprecated(since = "0.22.0", note = "It's a no-op now; just delete it.")]
71-
#[allow(clippy::wrong_self_convention)] // False positive
72-
pub fn from_errno(errno: Errno) -> Error {
73-
errno
74-
}
75-
76-
/// Create a new invalid argument error (`EINVAL`)
77-
#[deprecated(since = "0.22.0", note = "Use Errno::EINVAL instead")]
78-
pub const fn invalid_argument() -> Error {
79-
Errno::EINVAL
80-
}
81-
8254
pub fn last() -> Self {
8355
last()
8456
}
@@ -105,18 +77,6 @@ impl Errno {
10577
Ok(value)
10678
}
10779
}
108-
109-
/// Backwards compatibility hack for Nix <= 0.21.0 users
110-
///
111-
/// In older versions of Nix, `Error::Sys` was an enum variant. Now it's a
112-
/// function, which is compatible with most of the former use cases of the
113-
/// enum variant. But you should use `Error(Errno::...)` instead.
114-
#[deprecated(since = "0.22.0", note = "Use Errno::... instead")]
115-
#[allow(non_snake_case)]
116-
#[inline]
117-
pub const fn Sys(errno: Errno) -> Error {
118-
errno
119-
}
12080
}
12181

12282
/// The sentinel value indicates that a function failed and more detailed
@@ -1297,22 +1257,6 @@ mod consts {
12971257
EHWPOISON = libc::EHWPOISON,
12981258
}
12991259

1300-
#[deprecated(
1301-
since = "0.22.1",
1302-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1303-
)]
1304-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1305-
#[deprecated(
1306-
since = "0.22.1",
1307-
note = "use nix::errno::Errno::EDEADLOCK instead"
1308-
)]
1309-
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1310-
#[deprecated(
1311-
since = "0.22.1",
1312-
note = "use nix::errno::Errno::ENOTSUP instead"
1313-
)]
1314-
pub const ENOTSUP: Errno = Errno::EOPNOTSUPP;
1315-
13161260
impl Errno {
13171261
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
13181262
pub const EDEADLOCK: Errno = Errno::EDEADLK;
@@ -1576,22 +1520,6 @@ mod consts {
15761520
EQFULL = libc::EQFULL,
15771521
}
15781522

1579-
#[deprecated(
1580-
since = "0.22.1",
1581-
note = "use nix::errno::Errno::ELAST instead"
1582-
)]
1583-
pub const ELAST: Errno = Errno::EQFULL;
1584-
#[deprecated(
1585-
since = "0.22.1",
1586-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1587-
)]
1588-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1589-
#[deprecated(
1590-
since = "0.22.1",
1591-
note = "use nix::errno::Errno::EDEADLOCK instead"
1592-
)]
1593-
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1594-
15951523
impl Errno {
15961524
pub const ELAST: Errno = Errno::EQFULL;
15971525
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -1818,27 +1746,6 @@ mod consts {
18181746
EOWNERDEAD = libc::EOWNERDEAD,
18191747
}
18201748

1821-
#[deprecated(
1822-
since = "0.22.1",
1823-
note = "use nix::errno::Errno::ELAST instead"
1824-
)]
1825-
pub const ELAST: Errno = Errno::EOWNERDEAD;
1826-
#[deprecated(
1827-
since = "0.22.1",
1828-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1829-
)]
1830-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1831-
#[deprecated(
1832-
since = "0.22.1",
1833-
note = "use nix::errno::Errno::EDEADLOCK instead"
1834-
)]
1835-
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1836-
#[deprecated(
1837-
since = "0.22.1",
1838-
note = "use nix::errno::Errno::EOPNOTSUPP instead"
1839-
)]
1840-
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
1841-
18421749
impl Errno {
18431750
pub const ELAST: Errno = Errno::EOWNERDEAD;
18441751
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2056,27 +1963,6 @@ mod consts {
20561963
EASYNC = libc::EASYNC,
20571964
}
20581965

2059-
#[deprecated(
2060-
since = "0.22.1",
2061-
note = "use nix::errno::Errno::ELAST instead"
2062-
)]
2063-
pub const ELAST: Errno = Errno::EASYNC;
2064-
#[deprecated(
2065-
since = "0.22.1",
2066-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2067-
)]
2068-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2069-
#[deprecated(
2070-
since = "0.22.1",
2071-
note = "use nix::errno::Errno::EDEADLOCK instead"
2072-
)]
2073-
pub const EDEADLOCK: Errno = Errno::EDEADLK;
2074-
#[deprecated(
2075-
since = "0.22.1",
2076-
note = "use nix::errno::Errno::EOPNOTSUPP instead"
2077-
)]
2078-
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
2079-
20801966
impl Errno {
20811967
pub const ELAST: Errno = Errno::EASYNC;
20821968
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2291,17 +2177,6 @@ mod consts {
22912177
EPROTO = libc::EPROTO,
22922178
}
22932179

2294-
#[deprecated(
2295-
since = "0.22.1",
2296-
note = "use nix::errno::Errno::ELAST instead"
2297-
)]
2298-
pub const ELAST: Errno = Errno::ENOTSUP;
2299-
#[deprecated(
2300-
since = "0.22.1",
2301-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2302-
)]
2303-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2304-
23052180
impl Errno {
23062181
pub const ELAST: Errno = Errno::ENOTSUP;
23072182
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2516,17 +2391,6 @@ mod consts {
25162391
EPROTO = libc::EPROTO,
25172392
}
25182393

2519-
#[deprecated(
2520-
since = "0.22.1",
2521-
note = "use nix::errno::Errno::ELAST instead"
2522-
)]
2523-
pub const ELAST: Errno = Errno::ENOTSUP;
2524-
#[deprecated(
2525-
since = "0.22.1",
2526-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2527-
)]
2528-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2529-
25302394
impl Errno {
25312395
pub const ELAST: Errno = Errno::ENOTSUP;
25322396
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2731,12 +2595,6 @@ mod consts {
27312595
EPROTO = libc::EPROTO,
27322596
}
27332597

2734-
#[deprecated(
2735-
since = "0.22.1",
2736-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2737-
)]
2738-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2739-
27402598
impl Errno {
27412599
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
27422600
}
@@ -2965,17 +2823,6 @@ mod consts {
29652823
ESTALE = libc::ESTALE,
29662824
}
29672825

2968-
#[deprecated(
2969-
since = "0.22.1",
2970-
note = "use nix::errno::Errno::ELAST instead"
2971-
)]
2972-
pub const ELAST: Errno = Errno::ELAST;
2973-
#[deprecated(
2974-
since = "0.22.1",
2975-
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2976-
)]
2977-
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2978-
29792826
impl Errno {
29802827
pub const ELAST: Errno = Errno::ESTALE;
29812828
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;

0 commit comments

Comments
 (0)