Skip to content

Commit 8a794fa

Browse files
authored
Merge pull request #239 from Muscraft/fold-default
chore!: Make fold the default
2 parents 2db78b7 + 3e787fa commit 8a794fa

19 files changed

+93
-196
lines changed

benches/bench.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,11 @@ fn fold(bencher: divan::Bencher<'_, '_>, context: usize) {
7171
.bench_values(|(input, span)| {
7272
let message = &[
7373
Group::with_title(Level::ERROR.title("mismatched types").id("E0308")).element(
74-
Snippet::source(&input)
75-
.fold(true)
76-
.path("src/format.rs")
77-
.annotation(
78-
AnnotationKind::Context
79-
.span(span)
80-
.label("expected `Option<String>` because of return type"),
81-
),
74+
Snippet::source(&input).path("src/format.rs").annotation(
75+
AnnotationKind::Context
76+
.span(span)
77+
.label("expected `Option<String>` because of return type"),
78+
),
8279
),
8380
];
8481

examples/custom_error.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ pub static C: u32 = 0 - 1;
2222
.id("E0080"),
2323
)
2424
.element(
25-
Snippet::source(source)
26-
.path("$DIR/err.rs")
27-
.fold(true)
28-
.annotation(
29-
AnnotationKind::Primary
30-
.span(386..391)
31-
.label("attempt to compute `0_u32 - 1_u32`, which would overflow"),
32-
),
25+
Snippet::source(source).path("$DIR/err.rs").annotation(
26+
AnnotationKind::Primary
27+
.span(386..391)
28+
.label("attempt to compute `0_u32 - 1_u32`, which would overflow"),
29+
),
3330
)];
3431

3532
let renderer = Renderer::styled().theme(OutputTheme::Unicode);

examples/custom_level.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ fn main() {
3939
Snippet::source(source)
4040
.line_start(1)
4141
.path("$DIR/issue-114529-illegal-break-with-value.rs")
42-
.fold(true)
4342
.annotation(
4443
AnnotationKind::Primary
4544
.span(483..581)
@@ -60,7 +59,6 @@ fn main() {
6059
Snippet::source(source)
6160
.line_start(1)
6261
.path("$DIR/issue-114529-illegal-break-with-value.rs")
63-
.fold(true)
6462
.patch(Patch::new(483..581, "break")),
6563
),
6664
];

examples/expected_type.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ fn main() {
1111
Snippet::source(source)
1212
.line_start(26)
1313
.path("examples/footer.rs")
14-
.fold(true)
1514
.annotation(AnnotationKind::Primary.span(193..195).label(
1615
"expected struct `annotate_snippets::snippet::Slice`, found reference",
1716
))

examples/format.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
Snippet::source(source)
2929
.line_start(51)
3030
.path("src/format.rs")
31+
.fold(false)
3132
.annotation(
3233
AnnotationKind::Context
3334
.span(5..19)

examples/highlight_source.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ fn main() {}
1313
.id("E0010"))
1414
.element(
1515
Snippet::source(source)
16-
.fold(true)
1716
.path("$DIR/E0010-teach.rs")
1817
.annotation(
1918
AnnotationKind::Primary

examples/highlight_title.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ fn main() {
4545
Group::with_title(Level::ERROR.title("mismatched types").id("E0308"))
4646
.element(
4747
Snippet::source(source)
48-
.fold(true)
4948
.path("$DIR/highlighting.rs")
5049
.annotation(
5150
AnnotationKind::Primary
@@ -61,7 +60,6 @@ fn main() {
6160
.element(Level::NOTE.pre_styled_title(&title)),
6261
Group::with_title(Level::NOTE.title("function defined here")).element(
6362
Snippet::source(source)
64-
.fold(true)
6563
.path("$DIR/highlighting.rs")
6664
.annotation(AnnotationKind::Context.span(200..333).label(""))
6765
.annotation(AnnotationKind::Primary.span(194..199)),

examples/id_hyperlink.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ fn main() {
1717
Snippet::source(source)
1818
.line_start(1)
1919
.path("$DIR/terminal_urls.rs")
20-
.fold(true)
2120
.annotation(
2221
AnnotationKind::Primary
2322
.span(59..61)

examples/multislice.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ fn main() {
55
.element(
66
Snippet::<Annotation<'_>>::source("Foo")
77
.line_start(51)
8+
.fold(false)
89
.path("src/format.rs"),
910
)
1011
.element(
1112
Snippet::<Annotation<'_>>::source("Faa")
1213
.line_start(129)
14+
.fold(false)
1315
.path("src/display.rs"),
1416
)];
1517

src/renderer/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
//! Snippet::source(source)
3030
//! .path("temp.rs")
3131
//! .line_start(1)
32-
//! .fold(true)
3332
//! .annotation(
3433
//! AnnotationKind::Primary
3534
//! .span(10..13)

0 commit comments

Comments
 (0)