Skip to content

Commit 2d9273c

Browse files
zh-jqpvdrz
authored andcommitted
update to annotate-snippets 0.10.2
1 parent 39232cc commit 2d9273c

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

Cargo.lock

+11-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ name = "bindgen"
2525
path = "lib.rs"
2626

2727
[dependencies]
28-
annotate-snippets = { version = "0.9.1", features = ["color"], optional = true }
28+
annotate-snippets = { version = "0.10.2", optional = true }
2929
bitflags = "2.2.1"
3030
cexpr = "0.6"
3131
clang-sys = { version = "1", features = ["clang_11_0"] }

bindgen/diagnostics.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ use std::io::{self, BufRead, BufReader};
77
use std::{borrow::Cow, fs::File};
88

99
use annotate_snippets::{
10-
display_list::{DisplayList, FormatOptions},
11-
snippet::{Annotation, Slice as ExtSlice, Snippet},
10+
Annotation, AnnotationType, Renderer, Slice as ExtSlice, Snippet,
1211
};
1312

14-
use annotate_snippets::snippet::AnnotationType;
15-
1613
#[derive(Clone, Copy, Debug)]
1714
pub(crate) enum Level {
1815
Error,
@@ -121,12 +118,9 @@ impl<'a> Diagnostic<'a> {
121118
title,
122119
footer,
123120
slices,
124-
opt: FormatOptions {
125-
color: true,
126-
..Default::default()
127-
},
128121
};
129-
let dl = DisplayList::from(snippet);
122+
let renderer = Renderer::styled();
123+
let dl = renderer.render(snippet);
130124

131125
if INVOKED_BY_BUILD_SCRIPT.with(Clone::clone) {
132126
// This is just a hack which hides the `warning:` added by cargo at the beginning of

0 commit comments

Comments
 (0)