diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 82f530b..eaab632 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -297,9 +297,10 @@ impl DecorStyle { } } - fn file_start(&self, is_first: bool) -> &'static str { + fn file_start(&self, is_first: bool, alone: bool) -> &'static str { match self { DecorStyle::Ascii => "--> ", + DecorStyle::Unicode if is_first && alone => " ─▸ ", DecorStyle::Unicode if is_first => " ╭▸ ", DecorStyle::Unicode => " ├▸ ", } diff --git a/src/renderer/render.rs b/src/renderer/render.rs index 9ff2997..843147a 100644 --- a/src/renderer/render.rs +++ b/src/renderer/render.rs @@ -186,6 +186,7 @@ pub(crate) fn render(renderer: &Renderer, groups: Report<'_>) -> String { origin, is_primary, is_first, + peek.is_none(), buffer_msg_line_offset, ); let current_line = buffer.num_lines(); @@ -286,7 +287,7 @@ fn render_short_message(renderer: &Renderer, groups: &[Group<'_>]) -> Result, is_primary: bool, is_first: bool, + alone: bool, buffer_msg_line_offset: usize, ) { if is_primary && !renderer.short_message { buffer.prepend( buffer_msg_line_offset, - renderer.decor_style.file_start(is_first), + renderer.decor_style.file_start(is_first, alone), ElementStyle::LineNumber, ); } else if !renderer.short_message { @@ -558,6 +561,7 @@ fn render_snippet_annotations( &origin, is_primary, is_first, + false, buffer_msg_line_offset, ); // Put in the spacer between the location and annotated source @@ -574,7 +578,7 @@ fn render_snippet_annotations( buffer.puts( buffer_msg_line_offset, max_line_num_len, - renderer.decor_style.file_start(is_first), + renderer.decor_style.file_start(is_first, false), ElementStyle::LineNumber, ); } else { @@ -1462,7 +1466,7 @@ fn emit_suggestion_default( let (loc, _) = sm.span_to_locations(parts[0].span.clone()); // --> file.rs:line:col // | - let arrow = renderer.decor_style.file_start(is_first); + let arrow = renderer.decor_style.file_start(is_first, false); buffer.puts(row_num - 1, 0, arrow, ElementStyle::LineNumber); let message = format!("{}:{}:{}", path, loc.line, loc.char + 1); let col = usize::max(max_line_num_len + 1, arrow.len()); diff --git a/tests/color/multiline_removal_suggestion.unicode.term.svg b/tests/color/multiline_removal_suggestion.unicode.term.svg index 52360f4..ae2860d 100644 --- a/tests/color/multiline_removal_suggestion.unicode.term.svg +++ b/tests/color/multiline_removal_suggestion.unicode.term.svg @@ -39,7 +39,7 @@ note: required by a bound in `flatten` - ╭▸ /rustc/FAKE_PREFIX/library/core/src/iter/traits/iterator.rs:1556:4 + ─▸ /rustc/FAKE_PREFIX/library/core/src/iter/traits/iterator.rs:1556:4 help: consider removing this method call, as the receiver has type `std::vec::IntoIter<HashSet<u8>>` and `std::vec::IntoIter<HashSet<u8>>: Iterator` trivially holds diff --git a/tests/rustc_tests.rs b/tests/rustc_tests.rs index 94b08a6..298320f 100644 --- a/tests/rustc_tests.rs +++ b/tests/rustc_tests.rs @@ -4189,8 +4189,8 @@ LL │ let _ = quote! { $($ip)* }; //~ ERROR the method `quote_into_iter` ex `&mut Ipv4Addr: Iterator` which is required by `&mut Ipv4Addr: proc_macro::ext::RepIteratorExt` note: the traits `Iterator` and `ToTokens` must be implemented - ╭▸ $SRC_DIR/proc_macro/src/to_tokens.rs:11:0 - ╭▸ $SRC_DIR/core/src/iter/traits/iterator.rs:39:0 + ─▸ $SRC_DIR/proc_macro/src/to_tokens.rs:11:0 + ─▸ $SRC_DIR/core/src/iter/traits/iterator.rs:39:0 "#]]; let renderer = renderer.decor_style(DecorStyle::Unicode); assert_data_eq!(renderer.render(input), expected_unicode); @@ -4513,7 +4513,7 @@ LL │ ┃ } │ ╰ note: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types note: `core::alloc::Layout` is defined in crate `core` - ╭▸ $SRC_DIR/core/src/alloc/layout.rs:40:0 + ─▸ $SRC_DIR/core/src/alloc/layout.rs:40:0 note: `Layout` is defined in the current crate ╭▸ $DIR/alloc-error-handler-bad-signature-2.rs:7:1 │