From e5c7ae469e40a8bc102e1fca3b8fd4b2ec137696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sat, 3 Feb 2024 19:24:07 -0800 Subject: [PATCH] feat(deps): remove is-terminal dep in favor of `std::io::IsTerminal` --- .github/workflows/ci.yml | 8 ++++---- Cargo.toml | 8 +++----- src/handlers/theme.rs | 3 ++- src/protocol.rs | 2 +- tests/graphical.rs | 17 +++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32125cc5..e6871c4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,11 +27,11 @@ jobs: strategy: matrix: features: [fancy, syntect-highlighter] - rust: [1.56.0, stable] + rust: [1.70.0, stable] os: [ubuntu-latest, macOS-latest, windows-latest] exclude: - features: syntect-highlighter - rust: 1.56.0 + rust: 1.70.0 steps: - uses: actions/checkout@v4 @@ -41,7 +41,7 @@ jobs: toolchain: ${{ matrix.rust }} components: clippy - 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 - name: Clippy run: cargo clippy --all -- -D warnings @@ -49,7 +49,7 @@ jobs: if: matrix.rust == 'stable' run: cargo test --all --verbose --features ${{matrix.features}} - 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 miri: diff --git a/Cargo.toml b/Cargo.toml index 0123cc08..7567d951 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,11 +19,10 @@ once_cell = "1.8.0" unicode-width = "0.1.9" owo-colors = { version = "3.4.0", optional = true } -is-terminal = { version = "0.4.0", optional = true } textwrap = { version = "0.15.0", optional = true } -supports-hyperlinks = { version = "2.0.0", optional = true } -supports-color = { version = "2.0.0", optional = true } -supports-unicode = { version = "2.0.0", optional = true } +supports-hyperlinks = { version = "3.0.0", optional = true } +supports-color = { version = "3.0.0", optional = true } +supports-unicode = { version = "3.0.0", optional = true } backtrace = { version = "0.3.61", optional = true } terminal_size = { version = "0.3.0", optional = true } backtrace-ext = { version = "0.2.1", optional = true } @@ -51,7 +50,6 @@ derive = ["miette-derive"] no-format-args-capture = [] fancy-no-backtrace = [ "owo-colors", - "is-terminal", "textwrap", "terminal_size", "supports-hyperlinks", diff --git a/src/handlers/theme.rs b/src/handlers/theme.rs index aa6649e9..892ffc2d 100644 --- a/src/handlers/theme.rs +++ b/src/handlers/theme.rs @@ -1,4 +1,5 @@ -use is_terminal::IsTerminal; +use std::io::IsTerminal; + use owo_colors::Style; /** diff --git a/src/protocol.rs b/src/protocol.rs index 042526e4..8ca719df 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -257,7 +257,7 @@ impl LabeledSpan { pub const fn new(label: Option, offset: ByteOffset, len: usize) -> Self { Self { label, - span: SourceSpan::new(SourceOffset(offset), SourceOffset(len)), + span: SourceSpan::new(SourceOffset(offset), len), primary: false, } } diff --git a/tests/graphical.rs b/tests/graphical.rs index ac9ec10c..86d79e13 100644 --- a/tests/graphical.rs +++ b/tests/graphical.rs @@ -1842,11 +1842,11 @@ fn syntax_highlighter_on_real_file() { let expected = format!( r#" × This is an error ╭─[{filename}:{l2}:{CO}] - {l1} │ + {l1} │ {l2} │ let (filename, line) = (file!(), line!() as usize); · ─────────────┬───────────── · ╰── this is a label - {l3} │ + {l3} │ ╰──── "#, l1 = line - 1, @@ -1855,6 +1855,7 @@ fn syntax_highlighter_on_real_file() { ); assert!(out.contains("\u{1b}[38;2;180;142;173m")); assert_eq!(expected, strip_ansi_escapes::strip_str(out)); + } #[test] fn triple_adjacent_highlight() -> Result<(), MietteError> { @@ -1888,13 +1889,13 @@ fn triple_adjacent_highlight() -> Result<(), MietteError> { 1 │ source · ───┬── · ╰── this bit here - 2 │ - 3 │ + 2 │ + 3 │ 4 │ text · ──┬─ · ╰── also this bit - 5 │ - 6 │ + 5 │ + 6 │ 7 │ here · ──┬─ · ╰── finally we got @@ -1934,10 +1935,10 @@ fn non_adjacent_highlight() -> Result<(), MietteError> { 1 │ source · ───┬── · ╰── this bit here - 2 │ + 2 │ ╰──── ╭─[bad_file.rs:5:3] - 4 │ + 4 │ 5 │ text here · ──┬─ · ╰── also this bit