diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 590c83d..07abf53 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -647,23 +647,6 @@ impl Renderer { for _ in 0..max_line_num_len { buffer.prepend(buffer_msg_line_offset, " ", ElementStyle::NoStyle); } - - if let Some(label) = &origin.label { - self.draw_col_separator_no_space( - buffer, - buffer_msg_line_offset + 1, - max_line_num_len + 1, - ); - let title = Level::NOTE.title(label); - self.render_title( - buffer, - &title, - max_line_num_len, - TitleStyle::Secondary, - None, - false, - ); - } } #[allow(clippy::too_many_arguments)] diff --git a/src/snippet.rs b/src/snippet.rs index d3f5010..16f337a 100644 --- a/src/snippet.rs +++ b/src/snippet.rs @@ -382,7 +382,6 @@ pub struct Origin<'a> { pub(crate) line: Option, pub(crate) char_column: Option, pub(crate) primary: bool, - pub(crate) label: Option<&'a str>, } impl<'a> Origin<'a> { @@ -399,7 +398,6 @@ impl<'a> Origin<'a> { line: None, char_column: None, primary: false, - label: None, } } @@ -423,20 +421,6 @@ impl<'a> Origin<'a> { self.primary = primary; self } - - /// Like [`Annotation::label`], but when there is no source - /// - ///
- /// - /// Text passed to this function is considered "untrusted input", as such - /// all text is passed through a normalization function. Pre-styled text is - /// not allowed to be passed to this function. - /// - ///
- pub fn label(mut self, label: &'a str) -> Self { - self.label = Some(label); - self - } } fn newline_count(body: &str) -> usize { diff --git a/tests/rustc_tests.rs b/tests/rustc_tests.rs index eec19e5..0a1c531 100644 --- a/tests/rustc_tests.rs +++ b/tests/rustc_tests.rs @@ -2,7 +2,7 @@ //! //! [parser-tests]: https://github.com/rust-lang/rust/blob/894f7a4ba6554d3797404bbf550d9919df060b97/compiler/rustc_parse/src/parser/tests.rs -use annotate_snippets::{AnnotationKind, Group, Level, Origin, Patch, Renderer, Snippet}; +use annotate_snippets::{AnnotationKind, Group, Level, Origin, Padding, Patch, Renderer, Snippet}; use annotate_snippets::renderer::OutputTheme; use snapbox::{assert_data_eq, str}; @@ -1845,9 +1845,9 @@ fn main() { .line(334) .char_column(14) .primary(true) - .label("...because it uses `Self` as a type parameter") - ) + .element(Padding) + .element(Level::NOTE.title("...because it uses `Self` as a type parameter")) .element( Snippet::source(source) .line_start(1)