Skip to content

Commit da5100c

Browse files
committed
docs: Make styling standout more
1 parent 8375e0c commit da5100c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/highlight_message.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use annotate_snippets::{AnnotationKind, Group, Level, Renderer, Snippet};
2+
use anstyle::AnsiColor;
23
use anstyle::Effects;
4+
use anstyle::Style;
35

46
fn main() {
57
let source = r#"// Make sure "highlighted" code is colored purple
@@ -25,12 +27,10 @@ fn main() {
2527
query(wrapped_fn);
2628
}"#;
2729

28-
let magenta = annotate_snippets::renderer::AnsiColor::Magenta
29-
.on_default()
30-
.effects(Effects::BOLD);
30+
const MAGENTA: Style = AnsiColor::Magenta.on_default().effects(Effects::BOLD);
3131
let message = format!(
32-
"expected fn pointer `{magenta}for<'a>{magenta:#} fn(Box<{magenta}(dyn Any + Send + 'a){magenta:#}>) -> Pin<_>`
33-
found fn item `fn(Box<{magenta}(dyn Any + Send + 'static){magenta:#}>) -> Pin<_> {magenta}{{wrapped_fn}}{magenta:#}`",
32+
"expected fn pointer `{MAGENTA}for<'a>{MAGENTA:#} fn(Box<{MAGENTA}(dyn Any + Send + 'a){MAGENTA:#}>) -> Pin<_>`
33+
found fn item `fn(Box<{MAGENTA}(dyn Any + Send + 'static){MAGENTA:#}>) -> Pin<_> {MAGENTA}{{wrapped_fn}}{MAGENTA:#}`",
3434
);
3535

3636
let message = &[

0 commit comments

Comments
 (0)