Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
16 changes: 0 additions & 16 deletions src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ pub struct Origin<'a> {
pub(crate) line: Option<usize>,
pub(crate) char_column: Option<usize>,
pub(crate) primary: bool,
pub(crate) label: Option<&'a str>,
}

impl<'a> Origin<'a> {
Expand All @@ -399,7 +398,6 @@ impl<'a> Origin<'a> {
line: None,
char_column: None,
primary: false,
label: None,
}
}

Expand All @@ -423,20 +421,6 @@ impl<'a> Origin<'a> {
self.primary = primary;
self
}

/// Like [`Annotation::label`], but when there is no source
///
/// <div class="warning">
///
/// 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.
///
/// </div>
pub fn label(mut self, label: &'a str) -> Self {
self.label = Some(label);
self
}
}

fn newline_count(body: &str) -> usize {
Expand Down
6 changes: 3 additions & 3 deletions tests/rustc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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)
Expand Down
Loading