Skip to content

Commit 0f54a9a

Browse files
committed
chore: Get rid of Origin::label
1 parent 8284fd3 commit 0f54a9a

File tree

3 files changed

+3
-36
lines changed

3 files changed

+3
-36
lines changed

src/renderer/mod.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -647,23 +647,6 @@ impl Renderer {
647647
for _ in 0..max_line_num_len {
648648
buffer.prepend(buffer_msg_line_offset, " ", ElementStyle::NoStyle);
649649
}
650-
651-
if let Some(label) = &origin.label {
652-
self.draw_col_separator_no_space(
653-
buffer,
654-
buffer_msg_line_offset + 1,
655-
max_line_num_len + 1,
656-
);
657-
let title = Level::NOTE.title(label);
658-
self.render_title(
659-
buffer,
660-
&title,
661-
max_line_num_len,
662-
TitleStyle::Secondary,
663-
None,
664-
false,
665-
);
666-
}
667650
}
668651

669652
#[allow(clippy::too_many_arguments)]

src/snippet.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ pub struct Origin<'a> {
382382
pub(crate) line: Option<usize>,
383383
pub(crate) char_column: Option<usize>,
384384
pub(crate) primary: bool,
385-
pub(crate) label: Option<&'a str>,
386385
}
387386

388387
impl<'a> Origin<'a> {
@@ -399,7 +398,6 @@ impl<'a> Origin<'a> {
399398
line: None,
400399
char_column: None,
401400
primary: false,
402-
label: None,
403401
}
404402
}
405403

@@ -423,20 +421,6 @@ impl<'a> Origin<'a> {
423421
self.primary = primary;
424422
self
425423
}
426-
427-
/// Like [`Annotation::label`], but when there is no source
428-
///
429-
/// <div class="warning">
430-
///
431-
/// Text passed to this function is considered "untrusted input", as such
432-
/// all text is passed through a normalization function. Pre-styled text is
433-
/// not allowed to be passed to this function.
434-
///
435-
/// </div>
436-
pub fn label(mut self, label: &'a str) -> Self {
437-
self.label = Some(label);
438-
self
439-
}
440424
}
441425

442426
fn newline_count(body: &str) -> usize {

tests/rustc_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! [parser-tests]: https://github.com/rust-lang/rust/blob/894f7a4ba6554d3797404bbf550d9919df060b97/compiler/rustc_parse/src/parser/tests.rs
44
5-
use annotate_snippets::{AnnotationKind, Group, Level, Origin, Patch, Renderer, Snippet};
5+
use annotate_snippets::{AnnotationKind, Group, Level, Origin, Padding, Patch, Renderer, Snippet};
66

77
use annotate_snippets::renderer::OutputTheme;
88
use snapbox::{assert_data_eq, str};
@@ -1845,9 +1845,9 @@ fn main() {
18451845
.line(334)
18461846
.char_column(14)
18471847
.primary(true)
1848-
.label("...because it uses `Self` as a type parameter")
1849-
18501848
)
1849+
.element(Padding)
1850+
.element(Level::NOTE.title("...because it uses `Self` as a type parameter"))
18511851
.element(
18521852
Snippet::source(source)
18531853
.line_start(1)

0 commit comments

Comments
 (0)