summaryrefslogtreecommitdiffstats
path: root/vendor/annotate-snippets-0.8.0/examples/format.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/annotate-snippets-0.8.0/examples/format.rs
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/annotate-snippets-0.8.0/examples/format.rs')
-rw-r--r--vendor/annotate-snippets-0.8.0/examples/format.rs61
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/annotate-snippets-0.8.0/examples/format.rs b/vendor/annotate-snippets-0.8.0/examples/format.rs
deleted file mode 100644
index 98b77a140..000000000
--- a/vendor/annotate-snippets-0.8.0/examples/format.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-use annotate_snippets::{
- display_list::{DisplayList, FormatOptions},
- snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation},
-};
-
-fn main() {
- let snippet = Snippet {
- slices: vec![Slice {
- source: r#") -> Option<String> {
- for ann in annotations {
- match (ann.range.0, ann.range.1) {
- (None, None) => continue,
- (Some(start), Some(end)) if start > end_index => continue,
- (Some(start), Some(end)) if start >= start_index => {
- let label = if let Some(ref label) = ann.label {
- format!(" {}", label)
- } else {
- String::from("")
- };
-
- return Some(format!(
- "{}{}{}",
- " ".repeat(start - start_index),
- "^".repeat(end - start),
- label
- ));
- }
- _ => continue,
- }
- }"#,
- line_start: 51,
- origin: Some("src/format.rs"),
- fold: false,
- annotations: vec![
- SourceAnnotation {
- label: "expected `Option<String>` because of return type",
- annotation_type: AnnotationType::Warning,
- range: (5, 19),
- },
- SourceAnnotation {
- label: "expected enum `std::option::Option`",
- annotation_type: AnnotationType::Error,
- range: (26, 724),
- },
- ],
- }],
- title: Some(Annotation {
- label: Some("mismatched types"),
- id: Some("E0308"),
- annotation_type: AnnotationType::Error,
- }),
- footer: vec![],
- opt: FormatOptions {
- color: true,
- ..Default::default()
- },
- };
-
- let dl = DisplayList::from(snippet);
- println!("{}", dl);
-}