* feat(collection): add label(collection) documentation to lib.rs
* feat(collection): remove repeated formatting of label text
Because of a typo, the label text was being formatted multiple times per
label in a collection. With the fix, the text is formatted only once per
collection
* feat(collection): chain iterators rather than extend vector
Since we are going to iterate anyway, instead of growing the label vector,
chain the iterators. This should be more efficient.
In some cases, this also remove a compilation warning about the label
vector being unnecessarily mutable.
* feat(collection): remove unnecessary `OptionalWrapper`
- In a label collection, there is no need for a `None` label. One should
just not add that label
- Code wise it is also incorrect. The wrapper will be for a vector of
spans, not for individual spans. It happens to work anyway, but this was
not the intended use.
Fixes: https://github.com/zkat/miette/issues/315
Allow errors to have a number of labels determined at runtime.
An example of this is when the rust compiler labels all the arms of
a `match` expression when one of them has an incompatible type
To allow customization of the text for each label in a collection, add
support for using LabeledSpan in collections instead of just regular
spans
The commit e5c7ae4 seemed to (potentially erronously?) remove a number of
spaces following the left `|` bar of some graphical report handler tests.
That change had no effect on the `syntax_highlighter_on_real_file()`
test, presumably because the trailing whitespace is removed by
`strip_ansi_escapes::strip_str()`, but it did break the
`triple_adjacent_highlight()` and `non_adjacent_hightlight()` tests.
Restoring the spaces removed in e5c7ae4 fixes the failing tests on main.
* fix(ci): move from minimal-versions to direct-minimal-versions
Fixes: https://github.com/zkat/miette/issues/336
BREAKING CHANGE: This bumps owo-colors to 4.0, which is a breaking change because we expose its styles as part of the graphical renderer API
* ci: Update actions, replace actions-rs.
* `actions/checkout` is updated from `v1` to the current `v4`.
* `actions-rs/toolchain` is replaced by `dtolnay/rust-toolchain` as
the `actions-rs` actions haven't been maintained in a long time.
* clippy: Remove unnecessary call to `into_iter`.
The parameter takes `IntoIterator`, so we don't have to call
`into_iter` at the call site.
* clippy: Remove explicit lifetime that can be elided.
* clippy: tests: Fix useless conversion warnings.
* clippy: tests: Remove call to `format!`.
* Fix minimal-versions build.
Due to changes in the nightly compiler, using a recent nightly
requires proc-macro2 1.0.60 or later:
https://github.com/dtolnay/proc-macro2/issues/356
* ci: Use is-terminal 0.4.7 for MSRV builds.
is-terminal 0.4.8 updated its MSRV to 1.63, so we can't use it
with our MSRV of 1.56. Force usage of the older version which has
an older MSRV.
* Add more tests for diagnostic_source
* Use Borrow::borrow instead of AsRef
AsRef is not reflexive, meaning that it is not implemented as &T for all
T. Borrow is though, so we use that to make sure that we always get a
reference that is correct, even in the presence of smart pointers.