Skip to content

Commit

Permalink
don't use cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Jun 8, 2024
1 parent 504aa85 commit bd0f214
Showing 1 changed file with 21 additions and 41 deletions.
62 changes: 21 additions & 41 deletions crates/libs/result/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::*;
use crate::HRESULT;
use core::ffi::c_void;

#[allow(dead_code)] // for #[cfg(not_yet_stable)]
#[allow(dead_code)] // for cases that are not yet stabilized; see below
mod winerror {
use crate::HRESULT;

Expand Down Expand Up @@ -234,57 +234,37 @@ impl From<std::io::Error> for Error {
ErrorKind::PermissionDenied => w32(ERROR_ACCESS_DENIED),
ErrorKind::ConnectionRefused => w32(WSAECONNREFUSED),
ErrorKind::ConnectionReset => w32(WSAECONNRESET),
#[cfg(not_yet_stable)]
ErrorKind::HostUnreachable => w32(WSAEHOSTUNREACH),
#[cfg(not_yet_stable)]
ErrorKind::NetworkUnreachable => w32(WSAENETUNREACH),
// not yet stable: ErrorKind::HostUnreachable => w32(WSAEHOSTUNREACH),
// not yet stable: ErrorKind::NetworkUnreachable => w32(WSAENETUNREACH),
ErrorKind::ConnectionAborted => w32(WSAECONNABORTED),
ErrorKind::NotConnected => w32(WSAENOTCONN),
ErrorKind::AddrInUse => w32(WSAEADDRINUSE),
ErrorKind::AddrNotAvailable => w32(WSAEADDRNOTAVAIL),
#[cfg(not_yet_stable)]
ErrorKind::NetworkDown => w32(WSAENETDOWN),
// not yet stable: ErrorKind::NetworkDown => w32(WSAENETDOWN),
ErrorKind::BrokenPipe => w32(ERROR_BROKEN_PIPE),
ErrorKind::AlreadyExists => w32(ERROR_ALREADY_EXISTS),
ErrorKind::WouldBlock => w32(WSAEWOULDBLOCK),
#[cfg(not_yet_stable)]
ErrorKind::NotADirectory => _,
#[cfg(not_yet_stable)]
ErrorKind::IsADirectory => w32(ERROR_DIRECTORY_NOT_SUPPORTED),
#[cfg(not_yet_stable)]
ErrorKind::DirectoryNotEmpty => w32(ERROR_DIR_NOT_EMPTY),
#[cfg(not_yet_stable)]
ErrorKind::ReadOnlyFilesystem => w32(ERROR_FILE_READ_ONLY),
#[cfg(not_yet_stable)]
ErrorKind::FilesystemLoop => (),
#[cfg(not_yet_stable)]
ErrorKind::StaleNetworkFileHandle => (),
// not yet stable: ErrorKind::NotADirectory => _,
// not yet stable: ErrorKind::IsADirectory => w32(ERROR_DIRECTORY_NOT_SUPPORTED),
// not yet stable: ErrorKind::DirectoryNotEmpty => w32(ERROR_DIR_NOT_EMPTY),
// not yet stable: ErrorKind::ReadOnlyFilesystem => w32(ERROR_FILE_READ_ONLY),
// not yet stable: ErrorKind::FilesystemLoop => (),
// not yet stable: ErrorKind::StaleNetworkFileHandle => (),
ErrorKind::InvalidInput => E_INVALIDARG,
ErrorKind::InvalidData => w32(ERROR_INVALID_DATA),
ErrorKind::TimedOut => w32(ERROR_TIMEOUT),
ErrorKind::WriteZero => E_FAIL,
#[cfg(not_yet_stable)]
ErrorKind::StorageFull => w32(ERROR_HANDLE_DISK_FULL),
#[cfg(not_yet_stable)]
ErrorKind::NotSeekable => w32(ERROR_SEEK_ON_DEVICE),
#[cfg(not_yet_stable)]
ErrorKind::FilesystemQuotaExceeded => w32(ERROR_DISK_QUOTA_EXCEEDED),
#[cfg(not_yet_stable)]
ErrorKind::FileTooLarge => _,
#[cfg(not_yet_stable)]
ErrorKind::ResourceBusy => _,
#[cfg(not_yet_stable)]
ErrorKind::ExecutableFileBusy => _,
#[cfg(not_yet_stable)]
ErrorKind::Deadlock => w32(ERROR_POSSIBLE_DEADLOCK),
#[cfg(not_yet_stable)]
ErrorKind::CrossesDevices => _,
#[cfg(not_yet_stable)]
ErrorKind::TooManyLinks => _,
#[cfg(not_yet_stable)]
ErrorKind::InvalidFilename => _,
#[cfg(not_yet_stable)]
ErrorKind::ArgumentListTooLong => _,
// not yet stable: ErrorKind::StorageFull => w32(ERROR_HANDLE_DISK_FULL),
// not yet stable: ErrorKind::NotSeekable => w32(ERROR_SEEK_ON_DEVICE),
// not yet stable: ErrorKind::FilesystemQuotaExceeded => w32(ERROR_DISK_QUOTA_EXCEEDED),
// not yet stable: ErrorKind::FileTooLarge => _,
// not yet stable: ErrorKind::ResourceBusy => _,
// not yet stable: ErrorKind::ExecutableFileBusy => _,
// not yet stable: ErrorKind::Deadlock => w32(ERROR_POSSIBLE_DEADLOCK),
// not yet stable: ErrorKind::CrossesDevices => _,
// not yet stable: ErrorKind::TooManyLinks => _,
// not yet stable: ErrorKind::InvalidFilename => _,
// not yet stable: ErrorKind::ArgumentListTooLong => _,
ErrorKind::Interrupted => w32(WSAEINTR),
ErrorKind::Unsupported => w32(ERROR_NOT_SUPPORTED),
ErrorKind::UnexpectedEof => w32(ERROR_HANDLE_EOF),
Expand Down

0 comments on commit bd0f214

Please sign in to comment.