@@ -110,7 +110,7 @@ impl<'a> DisplayList<'a> {
110110 title,
111111 id,
112112 footer,
113- slices ,
113+ snippets ,
114114 } : snippet:: Message < ' a > ,
115115 stylesheet : & ' a Stylesheet ,
116116 anonymized_line_numbers : bool ,
@@ -120,9 +120,9 @@ impl<'a> DisplayList<'a> {
120120
121121 body. push ( format_title ( title, id) ) ;
122122
123- for ( idx, slice ) in slices . into_iter ( ) . enumerate ( ) {
123+ for ( idx, snippet ) in snippets . into_iter ( ) . enumerate ( ) {
124124 body. append ( & mut format_slice (
125- slice ,
125+ snippet ,
126126 idx == 0 ,
127127 !footer. is_empty ( ) ,
128128 margin,
@@ -542,7 +542,7 @@ pub enum DisplayLine<'a> {
542542/// A source line.
543543#[ derive( Debug , PartialEq ) ]
544544pub enum DisplaySourceLine < ' a > {
545- /// A line with the content of the Slice .
545+ /// A line with the content of the Snippet .
546546 Content {
547547 text : & ' a str ,
548548 range : ( usize , usize ) , // meta information for annotation placement.
@@ -762,15 +762,15 @@ fn format_footer(footer: snippet::Label<'_>) -> Vec<DisplayLine<'_>> {
762762}
763763
764764fn format_slice (
765- slice : snippet:: Slice < ' _ > ,
765+ snippet : snippet:: Snippet < ' _ > ,
766766 is_first : bool ,
767767 has_footer : bool ,
768768 margin : Option < Margin > ,
769769) -> Vec < DisplayLine < ' _ > > {
770- let main_range = slice . annotations . first ( ) . map ( |x| x. range . start ) ;
771- let origin = slice . origin ;
770+ let main_range = snippet . annotations . first ( ) . map ( |x| x. range . start ) ;
771+ let origin = snippet . origin ;
772772 let need_empty_header = origin. is_some ( ) || is_first;
773- let mut body = format_body ( slice , need_empty_header, has_footer, margin) ;
773+ let mut body = format_body ( snippet , need_empty_header, has_footer, margin) ;
774774 let header = format_header ( origin, main_range, & body, is_first) ;
775775 let mut result = vec ! [ ] ;
776776
@@ -942,13 +942,13 @@ fn fold_body(mut body: Vec<DisplayLine<'_>>) -> Vec<DisplayLine<'_>> {
942942}
943943
944944fn format_body (
945- slice : snippet:: Slice < ' _ > ,
945+ snippet : snippet:: Snippet < ' _ > ,
946946 need_empty_header : bool ,
947947 has_footer : bool ,
948948 margin : Option < Margin > ,
949949) -> Vec < DisplayLine < ' _ > > {
950- let source_len = slice . source . len ( ) ;
951- if let Some ( bigger) = slice . annotations . iter ( ) . find_map ( |x| {
950+ let source_len = snippet . source . len ( ) ;
951+ if let Some ( bigger) = snippet . annotations . iter ( ) . find_map ( |x| {
952952 // Allow highlighting one past the last character in the source.
953953 if source_len + 1 < x. range . end {
954954 Some ( & x. range )
@@ -963,7 +963,7 @@ fn format_body(
963963 }
964964
965965 let mut body = vec ! [ ] ;
966- let mut current_line = slice . line_start ;
966+ let mut current_line = snippet . line_start ;
967967 let mut current_index = 0 ;
968968 let mut line_info = vec ! [ ] ;
969969
@@ -972,7 +972,7 @@ fn format_body(
972972 line_end_index : usize ,
973973 }
974974
975- for ( line, end_line) in CursorLines :: new ( slice . source ) {
975+ for ( line, end_line) in CursorLines :: new ( snippet . source ) {
976976 let line_length: usize = line
977977 . chars ( )
978978 . map ( |c| unicode_width:: UnicodeWidthChar :: width ( c) . unwrap_or ( 0 ) )
@@ -995,7 +995,7 @@ fn format_body(
995995 }
996996
997997 let mut annotation_line_count = 0 ;
998- let mut annotations = slice . annotations ;
998+ let mut annotations = snippet . annotations ;
999999 for (
10001000 idx,
10011001 LineInfo {
@@ -1143,7 +1143,7 @@ fn format_body(
11431143 } ) ;
11441144 }
11451145
1146- if slice . fold {
1146+ if snippet . fold {
11471147 body = fold_body ( body) ;
11481148 }
11491149
@@ -1227,7 +1227,7 @@ mod tests {
12271227 let line_1 = "This is line 1" ;
12281228 let line_2 = "This is line 2" ;
12291229 let source = [ line_1, line_2] . join ( "\n " ) ;
1230- let input = snippet:: Message :: error ( "" ) . slice ( snippet:: Slice :: new ( & source, 5402 ) ) ;
1230+ let input = snippet:: Message :: error ( "" ) . snippet ( snippet:: Snippet :: new ( & source, 5402 ) ) ;
12311231 let output = from_display_lines ( vec ! [
12321232 DisplayLine :: Raw ( DisplayRawLine :: Annotation {
12331233 annotation: Annotation {
@@ -1278,8 +1278,8 @@ mod tests {
12781278 let src_1 = "This is slice 2" ;
12791279 let src_1_len = src_1. len ( ) ;
12801280 let input = snippet:: Message :: error ( "" )
1281- . slice ( snippet:: Slice :: new ( src_0, 5402 ) . origin ( "file1.rs" ) )
1282- . slice ( snippet:: Slice :: new ( src_1, 2 ) . origin ( "file2.rs" ) ) ;
1281+ . snippet ( snippet:: Snippet :: new ( src_0, 5402 ) . origin ( "file1.rs" ) )
1282+ . snippet ( snippet:: Snippet :: new ( src_1, 2 ) . origin ( "file2.rs" ) ) ;
12831283 let output = from_display_lines ( vec ! [
12841284 DisplayLine :: Raw ( DisplayRawLine :: Annotation {
12851285 annotation: Annotation {
@@ -1350,8 +1350,8 @@ mod tests {
13501350 let source = [ line_1, line_2] . join ( "\n " ) ;
13511351 // In line 2
13521352 let range = 22 ..24 ;
1353- let input = snippet:: Message :: error ( "" ) . slice (
1354- snippet:: Slice :: new ( & source, 5402 )
1353+ let input = snippet:: Message :: error ( "" ) . snippet (
1354+ snippet:: Snippet :: new ( & source, 5402 )
13551355 . annotation ( snippet:: Label :: info ( "Test annotation" ) . span ( range. clone ( ) ) ) ,
13561356 ) ;
13571357 let output = from_display_lines ( vec ! [
@@ -1455,17 +1455,17 @@ mod tests {
14551455 fn test_i26 ( ) {
14561456 let source = "short" ;
14571457 let label = "label" ;
1458- let input = snippet:: Message :: error ( "" ) . slice (
1459- snippet:: Slice :: new ( source, 0 )
1458+ let input = snippet:: Message :: error ( "" ) . snippet (
1459+ snippet:: Snippet :: new ( source, 0 )
14601460 . annotation ( snippet:: Label :: error ( label) . span ( 0 ..source. len ( ) + 2 ) ) ,
14611461 ) ;
14621462 let _ = DisplayList :: new ( input, & STYLESHEET , false , None ) ;
14631463 }
14641464
14651465 #[ test]
14661466 fn test_i_29 ( ) {
1467- let snippets = snippet:: Message :: error ( "oops" ) . slice (
1468- snippet:: Slice :: new ( "First line\r \n Second oops line" , 1 )
1467+ let snippets = snippet:: Message :: error ( "oops" ) . snippet (
1468+ snippet:: Snippet :: new ( "First line\r \n Second oops line" , 1 )
14691469 . origin ( "<current file>" )
14701470 . fold ( true )
14711471 . annotation ( snippet:: Label :: error ( "oops" ) . span ( 19 ..23 ) ) ,
0 commit comments