Commit Graph

555 Commits

Author SHA1 Message Date
Brooks J Rady d0d0f8492f docs(miette): sync README and `rustdoc` 2025-04-26 19:09:57 +01:00
Brooks J Rady c84c5fb355 fix(miette): another fix for MSRV 1.70 2025-04-26 18:56:34 +01:00
Brooks J Rady 792e8ba6ab fix(miette): maintain 1.70 MSRV 2025-04-26 18:54:31 +01:00
Brooks J Rady cf81969c4f fix(miette): match `TestError` visibility with `mod tests` 2025-04-26 18:48:43 +01:00
Brooks J Rady 79ee85ef0c fix(miette): correctly forward error sources 2025-04-26 18:45:52 +01:00
Brooks J Rady fdf0cd9b3e refactor(miette): make `thiserror` a dev-dependency 2025-04-26 16:46:28 +01:00
Brooks J Rady 53c8330f21 refactor(miette): reuse `DiagnosticError` in `protocol.rs` 2025-04-26 16:43:50 +01:00
Brooks J Rady 6d521a512a refactor(miette): remove `thiserror` from `into_diagnostic.rs` 2025-04-26 16:39:25 +01:00
Brooks J Rady ffe374c1a1 fix(fancy): `fancy` no longer depends on `derive`
Before this change, the `fancy` feature required the `derive` feature to
compile. Despite this, `derive` was not listed as a required feature to
use `fancy`. This meant that building with:
`cargo build --no-default-features --features fancy` would result in a
compilation error!

Now `fancy` can be used without `derive` enabled, and another use of
`thiserror` has been removed!
2025-04-26 16:18:20 +01:00
Brooks J Rady 3b1c87134a refactor(miette): remove `thiserror` from `error.rs` 2025-04-26 15:56:36 +01:00
Brooks J Rady 69c507bfef style(clippy): quickly fix up clippy lints 2025-04-26 15:25:47 +01:00
nogiro 59c81617de
feat(deps): update `thiserror` from 1.0.56 to 2.0.11 (#426) 2025-03-01 18:04:51 -08:00
Gabriel Levcovitz 58d9f12411
fix(highlight): increase syntax highlighter config priority (#424)
Fixes: https://github.com/zkat/miette/issues/337
2025-03-01 17:58:58 -08:00
Elijah Hartvigsen f2ef693d1c
feat(labels): add support for disabling the primary label line/col information (#419) 2025-03-01 17:56:47 -08:00
bohan a93afcf7e3
docs: introduce primary param in label (#413) 2025-03-01 17:55:37 -08:00
Gabriel Levcovitz 9ba6fad769
fix(clippy): elide lifetimes (#423) 2025-03-01 17:52:07 -08:00
Kat Marchán b8c144f2a6
(cargo-release) version 7.5.0 2025-01-31 18:50:56 -08:00
Kat Marchán 429ca37d8d
(cargo-release) version 7.5.0 2025-01-31 18:50:56 -08:00
Kat Marchán b4c983a393
docs: update changelog 2025-01-31 18:50:19 -08:00
unbyte 1e1938a099
fix(graphical): prevent leading newline when no link/code (#418) 2025-01-14 14:01:44 -08:00
ElKowar 771a07519f
feat(graphical): support rendering related diagnostics as nested (#417)
Fixes: https://github.com/zkat/miette/issues/416
2024-12-22 14:06:11 -08:00
Akiomi KAMAKURA c7eeada1e0
docs: fix broken link (#415) 2024-12-08 09:33:24 -08:00
Kat Marchán b2011f693b
chore: Release 2024-11-26 20:01:39 -08:00
Kat Marchán 0c46c0b4d4
docs: update changelog 2024-11-26 20:00:13 -08:00
Jalil David Salamé Messina 7fae60fd84
feat(report): Implement `WrapError` for `Option` (#409)
Fixes: https://github.com/zkat/miette/issues/408

Implement `WrapError` for `Option<T>`. This is inline with `anyhow` that
also implements `Context` for `Option<T>`.

The implementation requires us to introduce a `DisplayError` internal
only type, that creates an error from a type that only implements
`Display` (`Report::from_adhoc` requires the type to also implement
`Debug`, but `WrapError` only requires it to implement `Display`).

For this I copied `MessageError` and adapted it to implement `Debug`
using the underlying type's `Display` impl. This is a bit of a hack, but
anyhow does [something similar][1].

[1]: https://docs.rs/anyhow/latest/src/anyhow/wrapper.rs.html#34
2024-11-26 19:55:24 -08:00
George Pollard 465e6b6ab6
feat(graphical): Inherit source code to causes (#401) 2024-11-26 19:53:19 -08:00
Фаттахов Марат Русланович 68d47fa8b5
tests: Small refactor of doc tests (#396)
Move use NamedSource a bit up, since now it looks like it is not
imported.

Co-authored-by: Marat Fattakhov <m.fattakhov@yadro.com>
2024-11-26 19:50:56 -08:00
Kat Marchán 01564e070f
chore: Release 2024-11-26 00:44:33 -08:00
Kat Marchán fe068f6fc1
docs: update changelog 2024-11-26 00:43:02 -08:00
Gal Schlezinger 2902a2337c
docs(examples): add serde_json integration example (#407) 2024-11-13 09:57:24 -08:00
Bruce Mitchener 5f441d0115
fix(clippy): Fix `needless_return` lint. (#405)
This happens when building with `--features fancy`.
2024-09-26 09:32:58 -07:00
Cass Fridkin f3fb4c1ecd
feat(Diagnostic): Implement `Diagnostic` for `Infallible` (#402) 2024-09-25 10:30:33 -07:00
Bruce Mitchener d60c8f10f1
docs: Fix some broken links and missing backticks. (#399) 2024-09-25 10:29:12 -07:00
Bruce Mitchener 215f9aae33
docs: Fix typos (#398) 2024-09-25 10:28:30 -07:00
Bruce Mitchener 789a04e30d
fix(features): Use `dep:` syntax for dependencies in features. (#394)
This prevents creating implicit features for them which can be
confusing (and duplicates features).
2024-09-25 10:28:01 -07:00
Bruce Mitchener 21e9a70ad8
deps: Bump `terminal_size` to 0.4.0 (#404) 2024-09-25 10:14:22 -07:00
John Lewis 93d3bd118a
feat(Report): add `from_err()` method to `Report` (#403) 2024-09-06 23:56:01 -07:00
George Pollard d6b4558502
fix(graphical): Handle invalid UTF-8 in source code (#393)
* Handle invalid unicode in source

* Fix build on 1.70
2024-08-08 14:46:42 -07:00
Bruce Mitchener 15beec4330
fix(clippy): fix `clippy::doc_lazy_continuation` lints (#395)
* Fix `clippy::doc_lazy_continuation` lints

* Fix `dead_code` warnings in tests.

Protect code used in some tests based on features with feature
checks.

* Fix `clippy::needless_borrows_for_generic_args` lints

* Remove a useless conversion

* Remove a cfg_attr check for `track_caller`

This shouldn't be needed here as the test is already ignored.
2024-08-06 10:12:06 -07:00
Jonathan Dygert bf5aa3742f
fix(graphical): Format entire link instead of just name (#389) 2024-07-11 16:04:28 -07:00
Brooks Rady bdd1d74614
fix(report): conversion into `Box<dyn Diagnostic>` (#370)
Fixes: https://github.com/zkat/miette/issues/369

Diagnostic impls are no longer reset to default when converting a
`Report` into a `Box<dyn Diagnostic>`. Also prevented `Report` vtables
and handlers from being kept around on the heap after conversion.
2024-06-26 09:36:46 -07:00
Dániel Buga edfdcb525e
fix(handlers): Disable textwrap::smawk feature (#379) 2024-06-26 09:34:30 -07:00
Rintaro Itokawa 9bbcf3c601
fix(perf): mark error constructors cold (#378)
* refactor: mark error constructors cold

* refactor: remove `Send + Sync` impl
2024-06-26 09:33:42 -07:00
Benjamin Lee 73da45b65c
feat(SourceSpan): add impl From<InclusiveRange> (#385)
This can be used to avoid awkward `start..(end + 1)` constructions,
which will trigger the `clippy::range_plus_one` lint.

I added a single impl for `InclusiveRange` rather than a blanket
`impl<T: RangeBounds> From<T> for SourceSpan` for two reasons. The first
is that the blanket impl would be a breaking change (because dependent
crates may currently define a type `T: RangeBounds` and also have `impl
From<T> for SourceSpan`). The second is that this would allow one-sided
ranges (`..x`, `x..`). In order to support bounded-below ranges, we
would need to change `SourceSpan` so that `length` may depend on the the
specific `SourceCode` instance. That seems like an unlikely use case.
2024-06-26 09:31:50 -07:00
Luca Bruno b8dfcda4a8
perf(handlers): optimize string-buffer reallocations (#387)
This improves `get_lines()` logic by using a string-buffer with a capacity hint.
That avoids growing the buffer from zero each time, saving a bunch of reallocations.
2024-06-26 09:31:31 -07:00
Boshen e1026f75e0
fix(clippy): fix Rust v1.78.0 clippy warnings (#382) 2024-06-26 09:31:12 -07:00
Boshen 813232ba79
fix(color): setting NO_COLOR should not print ansi codes for non-terminals (#381)
Fixes: https://github.com/zkat/miette/issues/380
2024-06-11 09:18:24 -07:00
Sébastien Mischler b82cc81b8e
fix(docs): `alt` attribut for `single-line-example.png` (#372)
* fix(docs): `alt` attribut for `single-line-example.png`

The white line breaks in the `alt` attribute prevented the `single-line-example.png` image from being displayed.

* Revert "fix(docs): `alt` attribut for `single-line-example.png`"

This reverts commit 2e97d568aa.

* fix: image link in `lib.rs` instead of `readme.md`

* feat(docs): cargo make readme
2024-05-01 15:20:01 -07:00
Will Bush ea4296dace
fix(clippy): Fix clippy lints in docs (#365)
* Fix commented out code in lib.rs docs not found in README.md

* Fix clippy lints in README.md and lib.rs
2024-04-12 23:11:30 -07:00
TrapinchO 97766e8d90
docs: fix up previous docs change a bit (#362) 2024-04-03 14:58:36 -07:00