From 59fe74656a9b364fd10d361826ca3bd48551c73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sun, 10 Oct 2021 21:04:40 +1300 Subject: [PATCH] Stop using eyre even in examples --- Cargo.lock | 62 +------------------------------------- lib/Cargo.toml | 1 - lib/examples/demo.rs | 6 ++-- lib/examples/fs.rs | 8 ++--- lib/examples/signal.rs | 4 +-- lib/tests/error_handler.rs | 4 +-- 6 files changed, 12 insertions(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 54f8020..74d5b17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,33 +302,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "color-eyre" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f1885697ee8a177096d42f158922251a41973117f6d8a234cee94b9509157b7" -dependencies = [ - "backtrace", - "color-spantrace", - "eyre", - "indenter", - "once_cell", - "owo-colors 1.3.0", - "tracing-error", -] - -[[package]] -name = "color-spantrace" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6eee477a4a8a72f4addd4de416eb56d54bc307b284d6601bafdee1f4ea462d1" -dependencies = [ - "once_cell", - "owo-colors 1.3.0", - "tracing-core", - "tracing-error", -] - [[package]] name = "command-group" version = "1.0.6" @@ -541,16 +514,6 @@ dependencies = [ "syn 1.0.77", ] -[[package]] -name = "eyre" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221239d1d5ea86bf5d6f91c9d6bc3646ffe471b08ff9b0f91c44f115ac969d2b" -dependencies = [ - "indenter", - "once_cell", -] - [[package]] name = "fastrand" version = "1.5.0" @@ -929,12 +892,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - [[package]] name = "indexmap" version = "1.7.0" @@ -1189,7 +1146,7 @@ dependencies = [ "backtrace", "miette-derive", "once_cell", - "owo-colors 2.1.0", + "owo-colors", "supports-color", "supports-hyperlinks", "supports-unicode", @@ -1456,12 +1413,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "owo-colors" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2386b4ebe91c2f7f51082d4cefa145d030e33a1842a96b12e4885cc3c01f7a55" - [[package]] name = "owo-colors" version = "2.1.0" @@ -2461,16 +2412,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-error" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24" -dependencies = [ - "tracing", - "tracing-subscriber", -] - [[package]] name = "tracing-futures" version = "0.2.5" @@ -2705,7 +2646,6 @@ dependencies = [ "async-stream", "atomic-take", "clearscreen", - "color-eyre", "command-group", "dunce", "futures", diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 8dd0076..9b94e09 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -41,5 +41,4 @@ version = "1.10.0" features = ["full"] [dev-dependencies] -color-eyre = "0.5.11" tracing-subscriber = "0.2.19" diff --git a/lib/examples/demo.rs b/lib/examples/demo.rs index d48647c..7dc7e3e 100644 --- a/lib/examples/demo.rs +++ b/lib/examples/demo.rs @@ -1,5 +1,6 @@ use std::time::Duration; +use miette::{IntoDiagnostic, Result}; use watchexec::{ action::{Action, Outcome}, config::{InitConfig, RuntimeConfig}, @@ -11,9 +12,8 @@ use watchexec::{ // Run with: `env RUST_LOG=debug cargo run --example print_out` #[tokio::main] -async fn main() -> color_eyre::eyre::Result<()> { +async fn main() -> Result<()> { tracing_subscriber::fmt::init(); - color_eyre::install()?; let mut init = InitConfig::default(); init.on_error(|err| async move { @@ -65,7 +65,7 @@ async fn main() -> color_eyre::eyre::Result<()> { }); wx.reconfigure(runtime)?; - wx.main().await??; + wx.main().await.into_diagnostic()??; Ok(()) } diff --git a/lib/examples/fs.rs b/lib/examples/fs.rs index ee03d16..ef05209 100644 --- a/lib/examples/fs.rs +++ b/lib/examples/fs.rs @@ -1,5 +1,6 @@ use std::time::Duration; +use miette::{IntoDiagnostic, Result}; use tokio::{ sync::{mpsc, watch}, time::sleep, @@ -9,9 +10,8 @@ use watchexec::{event::Event, fs}; // Run with: `env RUST_LOG=debug cargo run --example fs`, // then touch some files within the first 15 seconds, and afterwards. #[tokio::main] -async fn main() -> color_eyre::eyre::Result<()> { +async fn main() -> Result<()> { tracing_subscriber::fmt::init(); - color_eyre::install()?; let (ev_s, mut ev_r) = mpsc::channel::(1024); let (er_s, mut er_r) = mpsc::channel(64); @@ -19,7 +19,7 @@ async fn main() -> color_eyre::eyre::Result<()> { let mut wkd = fs::WorkingData::default(); wkd.pathset = vec![".".into()]; - wd_s.send(wkd.clone())?; + wd_s.send(wkd.clone()).into_diagnostic()?; tokio::spawn(async move { while let Some(e) = ev_r.recv().await { @@ -42,7 +42,7 @@ async fn main() -> color_eyre::eyre::Result<()> { }); fs::worker(wd_r, er_s, ev_s).await?; - wd_sh.await?; + wd_sh.await.into_diagnostic()?; Ok(()) } diff --git a/lib/examples/signal.rs b/lib/examples/signal.rs index 7e41563..224fa3d 100644 --- a/lib/examples/signal.rs +++ b/lib/examples/signal.rs @@ -1,5 +1,6 @@ use std::process::exit; +use miette::Result; use tokio::sync::mpsc; use watchexec::{ event::{Event, Tag}, @@ -10,9 +11,8 @@ use watchexec::{ // then issue some signals to the printed PID, or hit e.g. Ctrl-C. // Send a SIGTERM (unix) or Ctrl-Break (windows) to exit. #[tokio::main] -async fn main() -> color_eyre::eyre::Result<()> { +async fn main() -> Result<()> { tracing_subscriber::fmt::init(); - color_eyre::install()?; let (ev_s, mut ev_r) = mpsc::channel::(1024); let (er_s, mut er_r) = mpsc::channel(64); diff --git a/lib/tests/error_handler.rs b/lib/tests/error_handler.rs index 2159648..8a60b31 100644 --- a/lib/tests/error_handler.rs +++ b/lib/tests/error_handler.rs @@ -1,5 +1,6 @@ use std::time::Duration; +use miette::Result; use tokio::time::sleep; use watchexec::{ config::{InitConfig, RuntimeConfig}, @@ -7,9 +8,8 @@ use watchexec::{ }; #[tokio::main] -async fn main() -> color_eyre::eyre::Result<()> { +async fn main() -> Result<()> { tracing_subscriber::fmt::init(); - color_eyre::install()?; let mut init = InitConfig::default(); init.on_error(|err| async move {