lang: deprecate io_err_other

For regular error cases, `std::io::Error` can now also box errors and
provides an `Error::other()` function since rust 1.74.

For the case where it was used directly with strings
(io_err_other("string")) -> that's what `io_format_err!()` and
`io_bail!()` are for.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-07-26 12:08:39 +02:00
parent ea3c37fd36
commit ce0b21805c

View File

@ -6,6 +6,7 @@ use std::io;
/// Helper to convert non-system-errors into an `io::Error` or `io::ErrorKind::Other`.
///
/// A more convenient way is to use the `io_format_err!` macro.
#[deprecated = "use std::io::Error::other instead to box the original error"]
pub fn io_err_other<E: ToString>(e: E) -> io::Error {
io::Error::new(std::io::ErrorKind::Other, e.to_string())
}