fix warnings on nightly

This commit is contained in:
Tiffany Bennett 2024-06-02 14:11:45 -07:00
parent 5859e928e9
commit df8b961edf
4 changed files with 22 additions and 16 deletions

12
Cargo.lock generated
View file

@ -705,17 +705,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "displaydoc"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
]
[[package]]
name = "encode_unicode"
version = "0.3.6"
@ -1839,7 +1828,6 @@ dependencies = [
"bincode",
"byteorder",
"color-eyre 0.5.11",
"displaydoc",
"serde",
"serde_derive",
"thiserror",

View file

@ -25,7 +25,7 @@ serde = { version = "1", features = ["rc"], default-features = false }
serde_derive = "1"
indexmap = "2"
[dev_dependencies]
[dev-dependencies]
serde_json = { version = "1", default-features = false }
assert-json-diff = "2.0.1"
similar-asserts = "1.1.0"

View file

@ -13,7 +13,6 @@ categories = ["command-line-utilities"]
[dependencies]
async-std = { version = "1.9", features = ["std", "unstable", "default"], default-features = false }
bincode = "1.3.3"
displaydoc = { version = "0.2", default-features = false }
thiserror = "1"
serde_derive = "1"
serde = { version = "1", default-features = false }

View file

@ -3,13 +3,13 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use async_std::channel::RecvError;
use displaydoc::Display;
use core::fmt;
use serde_derive::{Deserialize, Serialize};
use std::{io::Error as IoError, time::Duration};
use thiserror::Error;
/// All of the errors that can result while managing the child process.
#[derive(Error, Display, Debug)]
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
/// IO error
@ -38,6 +38,25 @@ pub enum Error {
Interrupted,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Io(_) => write!(f, "IO error"),
Error::Recv(err) => write!(f, "{}", err),
Error::Send(err) => write!(f, "Failed to send {err}"),
Error::Timeout(err) => write!(f, "Timed out after {err:?}"),
Error::Bincode(_) => write!(f, "Bincode"),
Error::Panic(err) => write!(f, "Panic: {err}"),
Error::InitFailure(_) => write!(f, "Failed to start child process"),
Error::ReadFailed(_) => write!(f, "Failed to read from child"),
Error::WriteFailed(_) => write!(f, "Failed to write to child"),
Error::HandshakeFailure(err) => write!(f, "Failed to start child process: {err}"),
Error::Crashed => write!(f, "Child process crashed"),
Error::Interrupted => write!(f, "Interrupted"),
}
}
}
impl From<IoError> for Error {
fn from(err: IoError) -> Self {
Error::Io(err)