@@ -1227,7 +1227,8 @@ 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 ( "" ) . snippet ( snippet:: Snippet :: new ( & source, 5402 ) ) ;
1230+ let input =
1231+ snippet:: Message :: error ( "" ) . snippet ( snippet:: Snippet :: new ( & source) . line_start ( 5402 ) ) ;
12311232 let output = from_display_lines ( vec ! [
12321233 DisplayLine :: Raw ( DisplayRawLine :: Annotation {
12331234 annotation: Annotation {
@@ -1278,8 +1279,16 @@ mod tests {
12781279 let src_1 = "This is slice 2" ;
12791280 let src_1_len = src_1. len ( ) ;
12801281 let input = snippet:: Message :: error ( "" )
1281- . snippet ( snippet:: Snippet :: new ( src_0, 5402 ) . origin ( "file1.rs" ) )
1282- . snippet ( snippet:: Snippet :: new ( src_1, 2 ) . origin ( "file2.rs" ) ) ;
1282+ . snippet (
1283+ snippet:: Snippet :: new ( src_0)
1284+ . line_start ( 5402 )
1285+ . origin ( "file1.rs" ) ,
1286+ )
1287+ . snippet (
1288+ snippet:: Snippet :: new ( src_1)
1289+ . line_start ( 2 )
1290+ . origin ( "file2.rs" ) ,
1291+ ) ;
12831292 let output = from_display_lines ( vec ! [
12841293 DisplayLine :: Raw ( DisplayRawLine :: Annotation {
12851294 annotation: Annotation {
@@ -1351,7 +1360,8 @@ mod tests {
13511360 // In line 2
13521361 let range = 22 ..24 ;
13531362 let input = snippet:: Message :: error ( "" ) . snippet (
1354- snippet:: Snippet :: new ( & source, 5402 )
1363+ snippet:: Snippet :: new ( & source)
1364+ . line_start ( 5402 )
13551365 . annotation ( snippet:: Label :: info ( "Test annotation" ) . span ( range. clone ( ) ) ) ,
13561366 ) ;
13571367 let output = from_display_lines ( vec ! [
@@ -1456,7 +1466,8 @@ mod tests {
14561466 let source = "short" ;
14571467 let label = "label" ;
14581468 let input = snippet:: Message :: error ( "" ) . snippet (
1459- snippet:: Snippet :: new ( source, 0 )
1469+ snippet:: Snippet :: new ( source)
1470+ . line_start ( 0 )
14601471 . annotation ( snippet:: Label :: error ( label) . span ( 0 ..source. len ( ) + 2 ) ) ,
14611472 ) ;
14621473 let _ = DisplayList :: new ( input, & STYLESHEET , false , None ) ;
@@ -1465,7 +1476,8 @@ mod tests {
14651476 #[ test]
14661477 fn test_i_29 ( ) {
14671478 let snippets = snippet:: Message :: error ( "oops" ) . snippet (
1468- snippet:: Snippet :: new ( "First line\r \n Second oops line" , 1 )
1479+ snippet:: Snippet :: new ( "First line\r \n Second oops line" )
1480+ . line_start ( 1 )
14691481 . origin ( "<current file>" )
14701482 . fold ( true )
14711483 . annotation ( snippet:: Label :: error ( "oops" ) . span ( 19 ..23 ) ) ,
0 commit comments