Skip to content

Commit e5c7ae4

Browse files
committedFeb 4, 2024
feat(deps): remove is-terminal dep in favor of std::io::IsTerminal
1 parent e65d0a7 commit e5c7ae4

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed
 

‎.github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
strategy:
2828
matrix:
2929
features: [fancy, syntect-highlighter]
30-
rust: [1.56.0, stable]
30+
rust: [1.70.0, stable]
3131
os: [ubuntu-latest, macOS-latest, windows-latest]
3232
exclude:
3333
- features: syntect-highlighter
34-
rust: 1.56.0
34+
rust: 1.70.0
3535

3636
steps:
3737
- uses: actions/checkout@v4
@@ -41,15 +41,15 @@ jobs:
4141
toolchain: ${{ matrix.rust }}
4242
components: clippy
4343
- name: Force older version of is-terminal for MSRV builds
44-
if: matrix.rust == '1.56.0'
44+
if: matrix.rust == '1.70.0'
4545
run: cargo update -p is-terminal --precise 0.4.7
4646
- name: Clippy
4747
run: cargo clippy --all -- -D warnings
4848
- name: Run tests
4949
if: matrix.rust == 'stable'
5050
run: cargo test --all --verbose --features ${{matrix.features}}
5151
- name: Run tests
52-
if: matrix.rust == '1.56.0'
52+
if: matrix.rust == '1.70.0'
5353
run: cargo test --all --verbose --features ${{matrix.features}} no-format-args-capture
5454

5555
miri:

‎Cargo.toml

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ once_cell = "1.8.0"
1919
unicode-width = "0.1.9"
2020

2121
owo-colors = { version = "3.4.0", optional = true }
22-
is-terminal = { version = "0.4.0", optional = true }
2322
textwrap = { version = "0.15.0", optional = true }
24-
supports-hyperlinks = { version = "2.0.0", optional = true }
25-
supports-color = { version = "2.0.0", optional = true }
26-
supports-unicode = { version = "2.0.0", optional = true }
23+
supports-hyperlinks = { version = "3.0.0", optional = true }
24+
supports-color = { version = "3.0.0", optional = true }
25+
supports-unicode = { version = "3.0.0", optional = true }
2726
backtrace = { version = "0.3.61", optional = true }
2827
terminal_size = { version = "0.3.0", optional = true }
2928
backtrace-ext = { version = "0.2.1", optional = true }
@@ -51,7 +50,6 @@ derive = ["miette-derive"]
5150
no-format-args-capture = []
5251
fancy-no-backtrace = [
5352
"owo-colors",
54-
"is-terminal",
5553
"textwrap",
5654
"terminal_size",
5755
"supports-hyperlinks",

‎src/handlers/theme.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use is_terminal::IsTerminal;
1+
use std::io::IsTerminal;
2+
23
use owo_colors::Style;
34

45
/**

‎src/protocol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl LabeledSpan {
257257
pub const fn new(label: Option<String>, offset: ByteOffset, len: usize) -> Self {
258258
Self {
259259
label,
260-
span: SourceSpan::new(SourceOffset(offset), SourceOffset(len)),
260+
span: SourceSpan::new(SourceOffset(offset), len),
261261
primary: false,
262262
}
263263
}

‎tests/graphical.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1842,11 +1842,11 @@ fn syntax_highlighter_on_real_file() {
18421842
let expected = format!(
18431843
r#" × This is an error
18441844
╭─[{filename}:{l2}:{CO}]
1845-
{l1} │
1845+
{l1} │
18461846
{l2} │ let (filename, line) = (file!(), line!() as usize);
18471847
· ─────────────┬─────────────
18481848
· ╰── this is a label
1849-
{l3} │
1849+
{l3} │
18501850
╰────
18511851
"#,
18521852
l1 = line - 1,
@@ -1855,6 +1855,7 @@ fn syntax_highlighter_on_real_file() {
18551855
);
18561856
assert!(out.contains("\u{1b}[38;2;180;142;173m"));
18571857
assert_eq!(expected, strip_ansi_escapes::strip_str(out));
1858+
}
18581859

18591860
#[test]
18601861
fn triple_adjacent_highlight() -> Result<(), MietteError> {
@@ -1888,13 +1889,13 @@ fn triple_adjacent_highlight() -> Result<(), MietteError> {
18881889
1 │ source
18891890
· ───┬──
18901891
· ╰── this bit here
1891-
2 │
1892-
3 │
1892+
2 │
1893+
3 │
18931894
4 │ text
18941895
· ──┬─
18951896
· ╰── also this bit
1896-
5 │
1897-
6 │
1897+
5 │
1898+
6 │
18981899
7 │ here
18991900
· ──┬─
19001901
· ╰── finally we got
@@ -1934,10 +1935,10 @@ fn non_adjacent_highlight() -> Result<(), MietteError> {
19341935
1 │ source
19351936
· ───┬──
19361937
· ╰── this bit here
1937-
2 │
1938+
2 │
19381939
╰────
19391940
╭─[bad_file.rs:5:3]
1940-
4 │
1941+
4 │
19411942
5 │ text here
19421943
· ──┬─
19431944
· ╰── also this bit

0 commit comments

Comments
 (0)
Please sign in to comment.