Skip to content

Commit

Permalink
feat(deps): remove is-terminal dep in favor of std::io::IsTerminal
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Feb 4, 2024
1 parent e65d0a7 commit e5c7ae4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,15 +41,15 @@ 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
- name: Run tests
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:
Expand Down
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -51,7 +50,6 @@ derive = ["miette-derive"]
no-format-args-capture = []
fancy-no-backtrace = [
"owo-colors",
"is-terminal",
"textwrap",
"terminal_size",
"supports-hyperlinks",
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/theme.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use is_terminal::IsTerminal;
use std::io::IsTerminal;

use owo_colors::Style;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl LabeledSpan {
pub const fn new(label: Option<String>, offset: ByteOffset, len: usize) -> Self {
Self {
label,
span: SourceSpan::new(SourceOffset(offset), SourceOffset(len)),
span: SourceSpan::new(SourceOffset(offset), len),
primary: false,
}
}
Expand Down
17 changes: 9 additions & 8 deletions tests/graphical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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> {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5c7ae4

Please sign in to comment.