mirror of https://github.com/zkat/miette.git
feat(deps): remove is-terminal dep in favor of `std::io::IsTerminal`
This commit is contained in:
parent
e65d0a78cc
commit
e5c7ae469e
|
|
@ -27,11 +27,11 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
features: [fancy, syntect-highlighter]
|
features: [fancy, syntect-highlighter]
|
||||||
rust: [1.56.0, stable]
|
rust: [1.70.0, stable]
|
||||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||||
exclude:
|
exclude:
|
||||||
- features: syntect-highlighter
|
- features: syntect-highlighter
|
||||||
rust: 1.56.0
|
rust: 1.70.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -41,7 +41,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
components: clippy
|
components: clippy
|
||||||
- name: Force older version of is-terminal for MSRV builds
|
- name: Force older version of is-terminal for MSRV builds
|
||||||
if: matrix.rust == '1.56.0'
|
if: matrix.rust == '1.70.0'
|
||||||
run: cargo update -p is-terminal --precise 0.4.7
|
run: cargo update -p is-terminal --precise 0.4.7
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
run: cargo clippy --all -- -D warnings
|
run: cargo clippy --all -- -D warnings
|
||||||
|
|
@ -49,7 +49,7 @@ jobs:
|
||||||
if: matrix.rust == 'stable'
|
if: matrix.rust == 'stable'
|
||||||
run: cargo test --all --verbose --features ${{matrix.features}}
|
run: cargo test --all --verbose --features ${{matrix.features}}
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
if: matrix.rust == '1.56.0'
|
if: matrix.rust == '1.70.0'
|
||||||
run: cargo test --all --verbose --features ${{matrix.features}} no-format-args-capture
|
run: cargo test --all --verbose --features ${{matrix.features}} no-format-args-capture
|
||||||
|
|
||||||
miri:
|
miri:
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,10 @@ once_cell = "1.8.0"
|
||||||
unicode-width = "0.1.9"
|
unicode-width = "0.1.9"
|
||||||
|
|
||||||
owo-colors = { version = "3.4.0", optional = true }
|
owo-colors = { version = "3.4.0", optional = true }
|
||||||
is-terminal = { version = "0.4.0", optional = true }
|
|
||||||
textwrap = { version = "0.15.0", optional = true }
|
textwrap = { version = "0.15.0", optional = true }
|
||||||
supports-hyperlinks = { version = "2.0.0", optional = true }
|
supports-hyperlinks = { version = "3.0.0", optional = true }
|
||||||
supports-color = { version = "2.0.0", optional = true }
|
supports-color = { version = "3.0.0", optional = true }
|
||||||
supports-unicode = { version = "2.0.0", optional = true }
|
supports-unicode = { version = "3.0.0", optional = true }
|
||||||
backtrace = { version = "0.3.61", optional = true }
|
backtrace = { version = "0.3.61", optional = true }
|
||||||
terminal_size = { version = "0.3.0", optional = true }
|
terminal_size = { version = "0.3.0", optional = true }
|
||||||
backtrace-ext = { version = "0.2.1", optional = true }
|
backtrace-ext = { version = "0.2.1", optional = true }
|
||||||
|
|
@ -51,7 +50,6 @@ derive = ["miette-derive"]
|
||||||
no-format-args-capture = []
|
no-format-args-capture = []
|
||||||
fancy-no-backtrace = [
|
fancy-no-backtrace = [
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
"is-terminal",
|
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"terminal_size",
|
"terminal_size",
|
||||||
"supports-hyperlinks",
|
"supports-hyperlinks",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use is_terminal::IsTerminal;
|
use std::io::IsTerminal;
|
||||||
|
|
||||||
use owo_colors::Style;
|
use owo_colors::Style;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ impl LabeledSpan {
|
||||||
pub const fn new(label: Option<String>, offset: ByteOffset, len: usize) -> Self {
|
pub const fn new(label: Option<String>, offset: ByteOffset, len: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
label,
|
label,
|
||||||
span: SourceSpan::new(SourceOffset(offset), SourceOffset(len)),
|
span: SourceSpan::new(SourceOffset(offset), len),
|
||||||
primary: false,
|
primary: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1842,11 +1842,11 @@ fn syntax_highlighter_on_real_file() {
|
||||||
let expected = format!(
|
let expected = format!(
|
||||||
r#" × This is an error
|
r#" × This is an error
|
||||||
╭─[{filename}:{l2}:{CO}]
|
╭─[{filename}:{l2}:{CO}]
|
||||||
{l1} │
|
{l1} │
|
||||||
{l2} │ let (filename, line) = (file!(), line!() as usize);
|
{l2} │ let (filename, line) = (file!(), line!() as usize);
|
||||||
· ─────────────┬─────────────
|
· ─────────────┬─────────────
|
||||||
· ╰── this is a label
|
· ╰── this is a label
|
||||||
{l3} │
|
{l3} │
|
||||||
╰────
|
╰────
|
||||||
"#,
|
"#,
|
||||||
l1 = line - 1,
|
l1 = line - 1,
|
||||||
|
|
@ -1855,6 +1855,7 @@ fn syntax_highlighter_on_real_file() {
|
||||||
);
|
);
|
||||||
assert!(out.contains("\u{1b}[38;2;180;142;173m"));
|
assert!(out.contains("\u{1b}[38;2;180;142;173m"));
|
||||||
assert_eq!(expected, strip_ansi_escapes::strip_str(out));
|
assert_eq!(expected, strip_ansi_escapes::strip_str(out));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn triple_adjacent_highlight() -> Result<(), MietteError> {
|
fn triple_adjacent_highlight() -> Result<(), MietteError> {
|
||||||
|
|
@ -1888,13 +1889,13 @@ fn triple_adjacent_highlight() -> Result<(), MietteError> {
|
||||||
1 │ source
|
1 │ source
|
||||||
· ───┬──
|
· ───┬──
|
||||||
· ╰── this bit here
|
· ╰── this bit here
|
||||||
2 │
|
2 │
|
||||||
3 │
|
3 │
|
||||||
4 │ text
|
4 │ text
|
||||||
· ──┬─
|
· ──┬─
|
||||||
· ╰── also this bit
|
· ╰── also this bit
|
||||||
5 │
|
5 │
|
||||||
6 │
|
6 │
|
||||||
7 │ here
|
7 │ here
|
||||||
· ──┬─
|
· ──┬─
|
||||||
· ╰── finally we got
|
· ╰── finally we got
|
||||||
|
|
@ -1934,10 +1935,10 @@ fn non_adjacent_highlight() -> Result<(), MietteError> {
|
||||||
1 │ source
|
1 │ source
|
||||||
· ───┬──
|
· ───┬──
|
||||||
· ╰── this bit here
|
· ╰── this bit here
|
||||||
2 │
|
2 │
|
||||||
╰────
|
╰────
|
||||||
╭─[bad_file.rs:5:3]
|
╭─[bad_file.rs:5:3]
|
||||||
4 │
|
4 │
|
||||||
5 │ text here
|
5 │ text here
|
||||||
· ──┬─
|
· ──┬─
|
||||||
· ╰── also this bit
|
· ╰── also this bit
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue