Repository: zkat/miette
Pull request #143 (2022-03-21 23:32:06)

chore(deps): Update textwrap to 0.15.0
To selfishly remove the duplicate I get when using `miette` with the latest `clap@v3` 💜 


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 31ca80d..693ae5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ unicode-width = "0.1.9"
 
 owo-colors = { version = "3.0.0", optional = true }
 atty = { version = "0.2.14", optional = true }
-textwrap = { version = "0.14.2", optional = true }
+textwrap = { version = "0.15.0", optional = true }
 supports-hyperlinks = { version = "1.1.0", optional = true }
 supports-color = { version = "1.0.4", optional = true }
 supports-unicode = { version = "1.0.0", optional = true }
@@ -38,7 +38,7 @@ syn = { version = "1.0", features = ["full"] }
 
 [features]
 default = []
-fancy = [
+fancy-no-backtrace = [
     "owo-colors",
     "atty",
     "textwrap",
@@ -46,6 +46,9 @@ fancy = [
     "supports-hyperlinks",
     "supports-color",
     "supports-unicode",
+]
+fancy = [
+    "fancy-no-backtrace",
     "backtrace",
 ]
 
diff --git a/README.md b/README.md
index 1792c9f..a55d9b1 100644
--- a/README.md
+++ b/README.md
@@ -530,12 +530,12 @@ the Apache License. Some code is taken from
 
 [`miette!`]: https://docs.rs/miette/latest/miette/macro.miette.html
 [`std::error::Error`]: https://doc.rust-lang.org/nightly/std/error/trait.Error.html
-[`Diagnostic`]: https://docs.rs/miette/latest/miette/struct.Diagnostic.html
+[`Diagnostic`]: https://docs.rs/miette/latest/miette/trait.Diagnostic.html
 [`IntoDiagnostic`]: https://docs.rs/miette/latest/miette/trait.IntoDiagnostic.html
 [`MietteHandlerOpts`]: https://docs.rs/miette/latest/miette/struct.MietteHandlerOpts.html
 [`MietteHandler`]: https://docs.rs/miette/latest/miette/struct.MietteHandler.html
 [`Report`]: https://docs.rs/miette/latest/miette/struct.Report.html
-[`ReportHandler`]: https://docs.rs/miette/latest/miette/struct.ReportHandler.html
+[`ReportHandler`]: https://docs.rs/miette/latest/miette/trait.ReportHandler.html
 [`Result`]: https://docs.rs/miette/latest/miette/type.Result.html
-[`SourceCode`]: https://docs.rs/miette/latest/miette/struct.SourceCode.html
+[`SourceCode`]: https://docs.rs/miette/latest/miette/trait.SourceCode.html
 [`SourceSpan`]: https://docs.rs/miette/latest/miette/struct.SourceSpan.html
diff --git a/src/eyreish/mod.rs b/src/eyreish/mod.rs
index 386daba..e7ada1d 100644
--- a/src/eyreish/mod.rs
+++ b/src/eyreish/mod.rs
@@ -26,10 +26,10 @@ pub use ReportHandler as EyreContext;
 #[allow(unreachable_pub)]
 pub use WrapErr as Context;
 
-#[cfg(not(feature = "fancy"))]
+#[cfg(not(feature = "fancy-no-backtrace"))]
 use crate::DebugReportHandler;
 use crate::Diagnostic;
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 use crate::MietteHandler;
 
 use error::ErrorImpl;
@@ -98,9 +98,9 @@ fn capture_handler(error: &(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler>
 }
 
 fn get_default_printer(_err: &(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler + 'static> {
-    #[cfg(feature = "fancy")]
+    #[cfg(feature = "fancy-no-backtrace")]
     return Box::new(MietteHandler::new());
-    #[cfg(not(feature = "fancy"))]
+    #[cfg(not(feature = "fancy-no-backtrace"))]
     return Box::new(DebugReportHandler::new());
 }
 
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 5df8e73..fde2dc9 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -5,20 +5,20 @@ Reporters included with `miette`.
 #[allow(unreachable_pub)]
 pub use debug::*;
 #[allow(unreachable_pub)]
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 pub use graphical::*;
 #[allow(unreachable_pub)]
 pub use json::*;
 #[allow(unreachable_pub)]
 pub use narratable::*;
 #[allow(unreachable_pub)]
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 pub use theme::*;
 
 mod debug;
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 mod graphical;
 mod json;
 mod narratable;
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 mod theme;
diff --git a/src/lib.rs b/src/lib.rs
index bb1cc6c..d52a8f9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -531,7 +531,7 @@ pub use miette_derive::*;
 
 pub use error::*;
 pub use eyreish::*;
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 pub use handler::*;
 pub use handlers::*;
 pub use named_source::*;
@@ -542,7 +542,7 @@ pub use protocol::*;
 mod chain;
 mod error;
 mod eyreish;
-#[cfg(feature = "fancy")]
+#[cfg(feature = "fancy-no-backtrace")]
 mod handler;
 mod handlers;
 mod named_source;


Test patch:
diff --git a/tests/graphical.rs b/tests/graphical.rs
index 0cd38b8..394a873 100644
--- a/tests/graphical.rs
+++ b/tests/graphical.rs
@@ -1,4 +1,4 @@
-#![cfg(feature = "fancy")]
+#![cfg(feature = "fancy-no-backtrace")]
 
 use miette::{
     Diagnostic, GraphicalReportHandler, GraphicalTheme, MietteError, NamedSource,
diff --git a/tests/narrated.rs b/tests/narrated.rs
index 038a806..c1656c3 100644
--- a/tests/narrated.rs
+++ b/tests/narrated.rs
@@ -1,4 +1,4 @@
-#![cfg(feature = "fancy")]
+#![cfg(feature = "fancy-no-backtrace")]
 
 use miette::{Diagnostic, MietteError, NamedSource, NarratableReportHandler, Report, SourceSpan};
 
@@ -9,8 +9,8 @@ use thiserror::Error;
 fn fmt_report(diag: Report) -> String {
     let mut out = String::new();
     // Mostly for dev purposes.
-    if cfg!(feature = "fancy") && std::env::var("STYLE").is_ok() {
-        #[cfg(feature = "fancy")]
+    if cfg!(feature = "fancy-no-backtrace") && std::env::var("STYLE").is_ok() {
+        #[cfg(feature = "fancy-no-backtrace")]
         GraphicalReportHandler::new_themed(GraphicalTheme::unicode())
             .render_report(&mut out, diag.as_ref())
             .unwrap();