diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-16 19:30:33 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-16 19:37:37 +0300 |
| commit | 108e88e211e783cc480fc3ae3fc84ddf9956d977 (patch) | |
| tree | cf6ca87c4c1df74d1a542a3c346b8445168cc5b7 | |
| parent | a693f64c4146909c295c63b6c1696148f4138a19 (diff) | |
| download | niri-108e88e211e783cc480fc3ae3fc84ddf9956d977.tar.gz niri-108e88e211e783cc480fc3ae3fc84ddf9956d977.tar.bz2 niri-108e88e211e783cc480fc3ae3fc84ddf9956d977.zip | |
Enable fancy miette errors for the main binary
Seems there's not much dependency/binary size impact now, compared to when I
first made the KDL config.
| -rw-r--r-- | Cargo.lock | 56 | ||||
| -rw-r--r-- | niri-config/Cargo.toml | 3 | ||||
| -rw-r--r-- | niri-config/src/lib.rs | 8 | ||||
| -rw-r--r-- | src/main.rs | 3 |
4 files changed, 2 insertions, 68 deletions
@@ -3,15 +3,6 @@ version = 3 [[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] name = "adler2" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -339,30 +330,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "backtrace-ext" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" -dependencies = [ - "backtrace", -] - -[[package]] name = "base64" version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1318,12 +1285,6 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] name = "gio" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2167,8 +2128,6 @@ version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ - "backtrace", - "backtrace-ext", "is-terminal", "miette-derive", "once_cell", @@ -2604,15 +2563,6 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] name = "once_cell" version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3176,12 +3126,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/niri-config/Cargo.toml b/niri-config/Cargo.toml index faf899a0..ec7a8e3d 100644 --- a/niri-config/Cargo.toml +++ b/niri-config/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true bitflags.workspace = true csscolorparser = "0.7.0" knuffel = "3.2.0" -miette = "5.10.0" +miette = { version = "5.10.0", features = ["fancy-no-backtrace"] } niri-ipc = { version = "25.1.0", path = "../niri-ipc" } regex = "1.11.1" smithay = { workspace = true, features = ["backend_libinput"] } @@ -20,5 +20,4 @@ tracy-client.workspace = true [dev-dependencies] insta.workspace = true -miette = { version = "5.10.0", features = ["fancy"] } pretty_assertions = "1.4.1" diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 54e2a3a9..769f5eba 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -12,7 +12,7 @@ use bitflags::bitflags; use knuffel::errors::DecodeError; use knuffel::Decode as _; use layer_rule::LayerRule; -use miette::{miette, Context, IntoDiagnostic, NarratableReportHandler}; +use miette::{miette, Context, IntoDiagnostic}; use niri_ipc::{ ColumnDisplay, ConfiguredMode, LayoutSwitchTarget, PositionChange, SizeChange, Transform, WorkspaceReferenceArg, @@ -3509,10 +3509,6 @@ impl FromStr for Percent { } } -pub fn set_miette_hook() -> Result<(), miette::InstallError> { - miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))) -} - #[cfg(test)] mod tests { use insta::{assert_debug_snapshot, assert_snapshot}; @@ -3523,8 +3519,6 @@ mod tests { #[track_caller] fn do_parse(text: &str) -> Config { - let _ = set_miette_hook(); - Config::parse("test.kdl", text) .map_err(miette::Report::new) .unwrap() diff --git a/src/main.rs b/src/main.rs index 0a79af2d..e11cd112 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,9 +90,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { env::set_var("XDG_SESSION_TYPE", "wayland"); } - // Set a better error printer for config loading. - niri_config::set_miette_hook().unwrap(); - // Handle subcommands. if let Some(subcommand) = cli.subcommand { match subcommand { |
