From f790e96d617e0a4c5c45f0c6b4b22a1403f74a3d Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 9 Oct 2021 06:08:07 -0500 Subject: [PATCH 1/3] use saturating substraction to calculate Line ranges --- src/controller.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controller.rs b/src/controller.rs index a737f09b5a..d106d1f2e5 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -177,7 +177,8 @@ impl<'b> Controller<'b> { if let Some(line_changes) = line_changes { for &line in line_changes.keys() { let line = line as usize; - line_ranges.push(LineRange::new(line - context, line + context)); + line_ranges + .push(LineRange::new(line.saturating_sub(context), line + context)); } } From 95d6ae5075e6770f354bbe42289adb16346030f8 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 9 Oct 2021 06:35:27 -0500 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 364ad0d4bd..a8b38ee760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ## Bugfixes - Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall) +- First line not shown in diff context. See #1891 (@divagant-martian) ## Performance From a31e8a1f8959165ed207bcfaee3d1986261f5e31 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 15 Oct 2021 16:43:38 -0500 Subject: [PATCH 3/3] update snapshot tests --- tests/snapshots/output/changes.snapshot.txt | 1 + .../output/changes_grid.snapshot.txt | 1 + .../output/changes_grid_header.snapshot.txt | 1 + .../changes_grid_header_numbers.snapshot.txt | 45 ++++++++++--------- ...nges_grid_header_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../changes_grid_header_rule.snapshot.txt | 1 + .../output/changes_grid_numbers.snapshot.txt | 45 ++++++++++--------- .../changes_grid_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../output/changes_grid_rule.snapshot.txt | 1 + .../output/changes_header.snapshot.txt | 1 + .../changes_header_numbers.snapshot.txt | 45 ++++++++++--------- .../changes_header_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../output/changes_header_rule.snapshot.txt | 1 + .../output/changes_numbers.snapshot.txt | 45 ++++++++++--------- .../output/changes_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../output/changes_rule.snapshot.txt | 1 + tests/snapshots/output/full.snapshot.txt | 45 ++++++++++--------- tests/snapshots/output/grid.snapshot.txt | 1 + .../snapshots/output/grid_header.snapshot.txt | 1 + .../output/grid_header_numbers.snapshot.txt | 45 ++++++++++--------- .../grid_header_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../output/grid_header_rule.snapshot.txt | 1 + .../output/grid_numbers.snapshot.txt | 45 ++++++++++--------- .../output/grid_numbers_rule.snapshot.txt | 45 ++++++++++--------- tests/snapshots/output/grid_rule.snapshot.txt | 1 + tests/snapshots/output/header.snapshot.txt | 1 + .../output/header_numbers.snapshot.txt | 45 ++++++++++--------- .../output/header_numbers_rule.snapshot.txt | 45 ++++++++++--------- .../snapshots/output/header_rule.snapshot.txt | 1 + tests/snapshots/output/numbers.snapshot.txt | 45 ++++++++++--------- .../output/numbers_rule.snapshot.txt | 45 ++++++++++--------- tests/snapshots/output/plain.snapshot.txt | 1 + tests/snapshots/output/rule.snapshot.txt | 1 + tests/snapshots/sample.modified.rs | 1 + 34 files changed, 408 insertions(+), 374 deletions(-) diff --git a/tests/snapshots/output/changes.snapshot.txt b/tests/snapshots/output/changes.snapshot.txt index 28d87201f0..6f88351717 100644 --- a/tests/snapshots/output/changes.snapshot.txt +++ b/tests/snapshots/output/changes.snapshot.txt @@ -1,3 +1,4 @@ ++ /// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/changes_grid.snapshot.txt b/tests/snapshots/output/changes_grid.snapshot.txt index 04767b8b3a..6de1f8f651 100644 --- a/tests/snapshots/output/changes_grid.snapshot.txt +++ b/tests/snapshots/output/changes_grid.snapshot.txt @@ -1,4 +1,5 @@ ──┬───────────────────────────────────────────────────────────────────────────── ++ │ /// A rectangle. First line is changed to prevent a regression of #1869 │ struct Rectangle { │ width: u32, │ height: u32, diff --git a/tests/snapshots/output/changes_grid_header.snapshot.txt b/tests/snapshots/output/changes_grid_header.snapshot.txt index 655b6e248f..98518e196e 100644 --- a/tests/snapshots/output/changes_grid_header.snapshot.txt +++ b/tests/snapshots/output/changes_grid_header.snapshot.txt @@ -1,6 +1,7 @@ ──┬───────────────────────────────────────────────────────────────────────────── │ File: sample.rs ──┼───────────────────────────────────────────────────────────────────────────── ++ │ /// A rectangle. First line is changed to prevent a regression of #1869 │ struct Rectangle { │ width: u32, │ height: u32, diff --git a/tests/snapshots/output/changes_grid_header_numbers.snapshot.txt b/tests/snapshots/output/changes_grid_header_numbers.snapshot.txt index cee4737f4d..f8ecaa32c3 100644 --- a/tests/snapshots/output/changes_grid_header_numbers.snapshot.txt +++ b/tests/snapshots/output/changes_grid_header_numbers.snapshot.txt @@ -1,26 +1,27 @@ ───────┬──────────────────────────────────────────────────────────────────────── │ File: sample.rs ───────┼──────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 _ │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 ~ │ "The perimeter of the rectangle is {} pixels.", - 11 ~ │ perimeter(&rect1) - 12 │ ); - 13 + │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 + │ - 20 + │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + │ (rectangle.width + rectangle.height) * 2 - 22 + │ } + 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 _ │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 ~ │ "The perimeter of the rectangle is {} pixels.", + 12 ~ │ perimeter(&rect1) + 13 │ ); + 14 + │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 + │ + 21 + │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + │ (rectangle.width + rectangle.height) * 2 + 23 + │ } ───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/changes_grid_header_numbers_rule.snapshot.txt b/tests/snapshots/output/changes_grid_header_numbers_rule.snapshot.txt index cee4737f4d..f8ecaa32c3 100644 --- a/tests/snapshots/output/changes_grid_header_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/changes_grid_header_numbers_rule.snapshot.txt @@ -1,26 +1,27 @@ ───────┬──────────────────────────────────────────────────────────────────────── │ File: sample.rs ───────┼──────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 _ │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 ~ │ "The perimeter of the rectangle is {} pixels.", - 11 ~ │ perimeter(&rect1) - 12 │ ); - 13 + │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 + │ - 20 + │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + │ (rectangle.width + rectangle.height) * 2 - 22 + │ } + 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 _ │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 ~ │ "The perimeter of the rectangle is {} pixels.", + 12 ~ │ perimeter(&rect1) + 13 │ ); + 14 + │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 + │ + 21 + │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + │ (rectangle.width + rectangle.height) * 2 + 23 + │ } ───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/changes_grid_header_rule.snapshot.txt b/tests/snapshots/output/changes_grid_header_rule.snapshot.txt index 655b6e248f..98518e196e 100644 --- a/tests/snapshots/output/changes_grid_header_rule.snapshot.txt +++ b/tests/snapshots/output/changes_grid_header_rule.snapshot.txt @@ -1,6 +1,7 @@ ──┬───────────────────────────────────────────────────────────────────────────── │ File: sample.rs ──┼───────────────────────────────────────────────────────────────────────────── ++ │ /// A rectangle. First line is changed to prevent a regression of #1869 │ struct Rectangle { │ width: u32, │ height: u32, diff --git a/tests/snapshots/output/changes_grid_numbers.snapshot.txt b/tests/snapshots/output/changes_grid_numbers.snapshot.txt index 7fe7cccfdc..0154a2b092 100644 --- a/tests/snapshots/output/changes_grid_numbers.snapshot.txt +++ b/tests/snapshots/output/changes_grid_numbers.snapshot.txt @@ -1,24 +1,25 @@ ───────┬──────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 _ │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 ~ │ "The perimeter of the rectangle is {} pixels.", - 11 ~ │ perimeter(&rect1) - 12 │ ); - 13 + │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 + │ - 20 + │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + │ (rectangle.width + rectangle.height) * 2 - 22 + │ } + 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 _ │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 ~ │ "The perimeter of the rectangle is {} pixels.", + 12 ~ │ perimeter(&rect1) + 13 │ ); + 14 + │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 + │ + 21 + │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + │ (rectangle.width + rectangle.height) * 2 + 23 + │ } ───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/changes_grid_numbers_rule.snapshot.txt b/tests/snapshots/output/changes_grid_numbers_rule.snapshot.txt index 7fe7cccfdc..0154a2b092 100644 --- a/tests/snapshots/output/changes_grid_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/changes_grid_numbers_rule.snapshot.txt @@ -1,24 +1,25 @@ ───────┬──────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 _ │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 ~ │ "The perimeter of the rectangle is {} pixels.", - 11 ~ │ perimeter(&rect1) - 12 │ ); - 13 + │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 + │ - 20 + │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + │ (rectangle.width + rectangle.height) * 2 - 22 + │ } + 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 _ │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 ~ │ "The perimeter of the rectangle is {} pixels.", + 12 ~ │ perimeter(&rect1) + 13 │ ); + 14 + │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 + │ + 21 + │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + │ (rectangle.width + rectangle.height) * 2 + 23 + │ } ───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/changes_grid_rule.snapshot.txt b/tests/snapshots/output/changes_grid_rule.snapshot.txt index 04767b8b3a..6de1f8f651 100644 --- a/tests/snapshots/output/changes_grid_rule.snapshot.txt +++ b/tests/snapshots/output/changes_grid_rule.snapshot.txt @@ -1,4 +1,5 @@ ──┬───────────────────────────────────────────────────────────────────────────── ++ │ /// A rectangle. First line is changed to prevent a regression of #1869 │ struct Rectangle { │ width: u32, │ height: u32, diff --git a/tests/snapshots/output/changes_header.snapshot.txt b/tests/snapshots/output/changes_header.snapshot.txt index 82fe8c47cb..d5c1afd920 100644 --- a/tests/snapshots/output/changes_header.snapshot.txt +++ b/tests/snapshots/output/changes_header.snapshot.txt @@ -1,4 +1,5 @@ File: sample.rs ++ /// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/changes_header_numbers.snapshot.txt b/tests/snapshots/output/changes_header_numbers.snapshot.txt index 77145eb9b2..cc99df08b3 100644 --- a/tests/snapshots/output/changes_header_numbers.snapshot.txt +++ b/tests/snapshots/output/changes_header_numbers.snapshot.txt @@ -1,23 +1,24 @@ File: sample.rs - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 _ fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 ~ "The perimeter of the rectangle is {} pixels.", - 11 ~ perimeter(&rect1) - 12 ); - 13 + println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 + - 20 + fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + (rectangle.width + rectangle.height) * 2 - 22 + } + 1 + /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 _ fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 ~ "The perimeter of the rectangle is {} pixels.", + 12 ~ perimeter(&rect1) + 13 ); + 14 + println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + + 21 + fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + (rectangle.width + rectangle.height) * 2 + 23 + } diff --git a/tests/snapshots/output/changes_header_numbers_rule.snapshot.txt b/tests/snapshots/output/changes_header_numbers_rule.snapshot.txt index 77145eb9b2..cc99df08b3 100644 --- a/tests/snapshots/output/changes_header_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/changes_header_numbers_rule.snapshot.txt @@ -1,23 +1,24 @@ File: sample.rs - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 _ fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 ~ "The perimeter of the rectangle is {} pixels.", - 11 ~ perimeter(&rect1) - 12 ); - 13 + println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 + - 20 + fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + (rectangle.width + rectangle.height) * 2 - 22 + } + 1 + /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 _ fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 ~ "The perimeter of the rectangle is {} pixels.", + 12 ~ perimeter(&rect1) + 13 ); + 14 + println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + + 21 + fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + (rectangle.width + rectangle.height) * 2 + 23 + } diff --git a/tests/snapshots/output/changes_header_rule.snapshot.txt b/tests/snapshots/output/changes_header_rule.snapshot.txt index 82fe8c47cb..d5c1afd920 100644 --- a/tests/snapshots/output/changes_header_rule.snapshot.txt +++ b/tests/snapshots/output/changes_header_rule.snapshot.txt @@ -1,4 +1,5 @@ File: sample.rs ++ /// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/changes_numbers.snapshot.txt b/tests/snapshots/output/changes_numbers.snapshot.txt index bdfe745bff..5b4044110e 100644 --- a/tests/snapshots/output/changes_numbers.snapshot.txt +++ b/tests/snapshots/output/changes_numbers.snapshot.txt @@ -1,22 +1,23 @@ - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 _ fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 ~ "The perimeter of the rectangle is {} pixels.", - 11 ~ perimeter(&rect1) - 12 ); - 13 + println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 + - 20 + fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + (rectangle.width + rectangle.height) * 2 - 22 + } + 1 + /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 _ fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 ~ "The perimeter of the rectangle is {} pixels.", + 12 ~ perimeter(&rect1) + 13 ); + 14 + println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + + 21 + fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + (rectangle.width + rectangle.height) * 2 + 23 + } diff --git a/tests/snapshots/output/changes_numbers_rule.snapshot.txt b/tests/snapshots/output/changes_numbers_rule.snapshot.txt index bdfe745bff..5b4044110e 100644 --- a/tests/snapshots/output/changes_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/changes_numbers_rule.snapshot.txt @@ -1,22 +1,23 @@ - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 _ fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 ~ "The perimeter of the rectangle is {} pixels.", - 11 ~ perimeter(&rect1) - 12 ); - 13 + println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 + - 20 + fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + (rectangle.width + rectangle.height) * 2 - 22 + } + 1 + /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 _ fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 ~ "The perimeter of the rectangle is {} pixels.", + 12 ~ perimeter(&rect1) + 13 ); + 14 + println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + + 21 + fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + (rectangle.width + rectangle.height) * 2 + 23 + } diff --git a/tests/snapshots/output/changes_rule.snapshot.txt b/tests/snapshots/output/changes_rule.snapshot.txt index 28d87201f0..6f88351717 100644 --- a/tests/snapshots/output/changes_rule.snapshot.txt +++ b/tests/snapshots/output/changes_rule.snapshot.txt @@ -1,3 +1,4 @@ ++ /// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/full.snapshot.txt b/tests/snapshots/output/full.snapshot.txt index cee4737f4d..f8ecaa32c3 100644 --- a/tests/snapshots/output/full.snapshot.txt +++ b/tests/snapshots/output/full.snapshot.txt @@ -1,26 +1,27 @@ ───────┬──────────────────────────────────────────────────────────────────────── │ File: sample.rs ───────┼──────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 _ │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 ~ │ "The perimeter of the rectangle is {} pixels.", - 11 ~ │ perimeter(&rect1) - 12 │ ); - 13 + │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 + │ - 20 + │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 + │ (rectangle.width + rectangle.height) * 2 - 22 + │ } + 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 _ │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 ~ │ "The perimeter of the rectangle is {} pixels.", + 12 ~ │ perimeter(&rect1) + 13 │ ); + 14 + │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 + │ + 21 + │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 + │ (rectangle.width + rectangle.height) * 2 + 23 + │ } ───────┴──────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/grid.snapshot.txt b/tests/snapshots/output/grid.snapshot.txt index 5b970581f5..7061949760 100644 --- a/tests/snapshots/output/grid.snapshot.txt +++ b/tests/snapshots/output/grid.snapshot.txt @@ -1,4 +1,5 @@ ──────────────────────────────────────────────────────────────────────────────── +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/grid_header.snapshot.txt b/tests/snapshots/output/grid_header.snapshot.txt index 50c16941e9..010e3a8137 100644 --- a/tests/snapshots/output/grid_header.snapshot.txt +++ b/tests/snapshots/output/grid_header.snapshot.txt @@ -1,6 +1,7 @@ ──────────────────────────────────────────────────────────────────────────────── File: sample.rs ──────────────────────────────────────────────────────────────────────────────── +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/grid_header_numbers.snapshot.txt b/tests/snapshots/output/grid_header_numbers.snapshot.txt index e9f1a9cfe6..dfbb934bb7 100644 --- a/tests/snapshots/output/grid_header_numbers.snapshot.txt +++ b/tests/snapshots/output/grid_header_numbers.snapshot.txt @@ -1,26 +1,27 @@ ─────┬────────────────────────────────────────────────────────────────────────── │ File: sample.rs ─────┼────────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 │ "The perimeter of the rectangle is {} pixels.", - 11 │ perimeter(&rect1) - 12 │ ); - 13 │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 │ - 20 │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 │ (rectangle.width + rectangle.height) * 2 - 22 │ } + 1 │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 │ "The perimeter of the rectangle is {} pixels.", + 12 │ perimeter(&rect1) + 13 │ ); + 14 │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 │ + 21 │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 │ (rectangle.width + rectangle.height) * 2 + 23 │ } ─────┴────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/grid_header_numbers_rule.snapshot.txt b/tests/snapshots/output/grid_header_numbers_rule.snapshot.txt index e9f1a9cfe6..dfbb934bb7 100644 --- a/tests/snapshots/output/grid_header_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/grid_header_numbers_rule.snapshot.txt @@ -1,26 +1,27 @@ ─────┬────────────────────────────────────────────────────────────────────────── │ File: sample.rs ─────┼────────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 │ "The perimeter of the rectangle is {} pixels.", - 11 │ perimeter(&rect1) - 12 │ ); - 13 │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 │ - 20 │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 │ (rectangle.width + rectangle.height) * 2 - 22 │ } + 1 │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 │ "The perimeter of the rectangle is {} pixels.", + 12 │ perimeter(&rect1) + 13 │ ); + 14 │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 │ + 21 │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 │ (rectangle.width + rectangle.height) * 2 + 23 │ } ─────┴────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/grid_header_rule.snapshot.txt b/tests/snapshots/output/grid_header_rule.snapshot.txt index 50c16941e9..010e3a8137 100644 --- a/tests/snapshots/output/grid_header_rule.snapshot.txt +++ b/tests/snapshots/output/grid_header_rule.snapshot.txt @@ -1,6 +1,7 @@ ──────────────────────────────────────────────────────────────────────────────── File: sample.rs ──────────────────────────────────────────────────────────────────────────────── +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/grid_numbers.snapshot.txt b/tests/snapshots/output/grid_numbers.snapshot.txt index 0961466704..83ee57cdca 100644 --- a/tests/snapshots/output/grid_numbers.snapshot.txt +++ b/tests/snapshots/output/grid_numbers.snapshot.txt @@ -1,24 +1,25 @@ ─────┬────────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 │ "The perimeter of the rectangle is {} pixels.", - 11 │ perimeter(&rect1) - 12 │ ); - 13 │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 │ - 20 │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 │ (rectangle.width + rectangle.height) * 2 - 22 │ } + 1 │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 │ "The perimeter of the rectangle is {} pixels.", + 12 │ perimeter(&rect1) + 13 │ ); + 14 │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 │ + 21 │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 │ (rectangle.width + rectangle.height) * 2 + 23 │ } ─────┴────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/grid_numbers_rule.snapshot.txt b/tests/snapshots/output/grid_numbers_rule.snapshot.txt index 0961466704..83ee57cdca 100644 --- a/tests/snapshots/output/grid_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/grid_numbers_rule.snapshot.txt @@ -1,24 +1,25 @@ ─────┬────────────────────────────────────────────────────────────────────────── - 1 │ struct Rectangle { - 2 │ width: u32, - 3 │ height: u32, - 4 │ } - 5 │ - 6 │ fn main() { - 7 │ let rect1 = Rectangle { width: 30, height: 50 }; - 8 │ - 9 │ println!( - 10 │ "The perimeter of the rectangle is {} pixels.", - 11 │ perimeter(&rect1) - 12 │ ); - 13 │ println!(r#"This line contains invalid utf8: "�����"#; - 14 │ } - 15 │ - 16 │ fn area(rectangle: &Rectangle) -> u32 { - 17 │ rectangle.width * rectangle.height - 18 │ } - 19 │ - 20 │ fn perimeter(rectangle: &Rectangle) -> u32 { - 21 │ (rectangle.width + rectangle.height) * 2 - 22 │ } + 1 │ /// A rectangle. First line is changed to prevent a regression of #1869 + 2 │ struct Rectangle { + 3 │ width: u32, + 4 │ height: u32, + 5 │ } + 6 │ + 7 │ fn main() { + 8 │ let rect1 = Rectangle { width: 30, height: 50 }; + 9 │ + 10 │ println!( + 11 │ "The perimeter of the rectangle is {} pixels.", + 12 │ perimeter(&rect1) + 13 │ ); + 14 │ println!(r#"This line contains invalid utf8: "�����"#; + 15 │ } + 16 │ + 17 │ fn area(rectangle: &Rectangle) -> u32 { + 18 │ rectangle.width * rectangle.height + 19 │ } + 20 │ + 21 │ fn perimeter(rectangle: &Rectangle) -> u32 { + 22 │ (rectangle.width + rectangle.height) * 2 + 23 │ } ─────┴────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/output/grid_rule.snapshot.txt b/tests/snapshots/output/grid_rule.snapshot.txt index 5b970581f5..7061949760 100644 --- a/tests/snapshots/output/grid_rule.snapshot.txt +++ b/tests/snapshots/output/grid_rule.snapshot.txt @@ -1,4 +1,5 @@ ──────────────────────────────────────────────────────────────────────────────── +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/header.snapshot.txt b/tests/snapshots/output/header.snapshot.txt index 0889edfd32..3cbbad49d2 100644 --- a/tests/snapshots/output/header.snapshot.txt +++ b/tests/snapshots/output/header.snapshot.txt @@ -1,4 +1,5 @@ File: sample.rs +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/header_numbers.snapshot.txt b/tests/snapshots/output/header_numbers.snapshot.txt index a681e6b407..82fa9175a5 100644 --- a/tests/snapshots/output/header_numbers.snapshot.txt +++ b/tests/snapshots/output/header_numbers.snapshot.txt @@ -1,23 +1,24 @@ File: sample.rs - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 "The perimeter of the rectangle is {} pixels.", - 11 perimeter(&rect1) - 12 ); - 13 println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 - 20 fn perimeter(rectangle: &Rectangle) -> u32 { - 21 (rectangle.width + rectangle.height) * 2 - 22 } + 1 /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 "The perimeter of the rectangle is {} pixels.", + 12 perimeter(&rect1) + 13 ); + 14 println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + 21 fn perimeter(rectangle: &Rectangle) -> u32 { + 22 (rectangle.width + rectangle.height) * 2 + 23 } diff --git a/tests/snapshots/output/header_numbers_rule.snapshot.txt b/tests/snapshots/output/header_numbers_rule.snapshot.txt index a681e6b407..82fa9175a5 100644 --- a/tests/snapshots/output/header_numbers_rule.snapshot.txt +++ b/tests/snapshots/output/header_numbers_rule.snapshot.txt @@ -1,23 +1,24 @@ File: sample.rs - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 "The perimeter of the rectangle is {} pixels.", - 11 perimeter(&rect1) - 12 ); - 13 println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 - 20 fn perimeter(rectangle: &Rectangle) -> u32 { - 21 (rectangle.width + rectangle.height) * 2 - 22 } + 1 /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 "The perimeter of the rectangle is {} pixels.", + 12 perimeter(&rect1) + 13 ); + 14 println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + 21 fn perimeter(rectangle: &Rectangle) -> u32 { + 22 (rectangle.width + rectangle.height) * 2 + 23 } diff --git a/tests/snapshots/output/header_rule.snapshot.txt b/tests/snapshots/output/header_rule.snapshot.txt index 0889edfd32..3cbbad49d2 100644 --- a/tests/snapshots/output/header_rule.snapshot.txt +++ b/tests/snapshots/output/header_rule.snapshot.txt @@ -1,4 +1,5 @@ File: sample.rs +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/numbers.snapshot.txt b/tests/snapshots/output/numbers.snapshot.txt index c1341d29df..560e755702 100644 --- a/tests/snapshots/output/numbers.snapshot.txt +++ b/tests/snapshots/output/numbers.snapshot.txt @@ -1,22 +1,23 @@ - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 "The perimeter of the rectangle is {} pixels.", - 11 perimeter(&rect1) - 12 ); - 13 println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 - 20 fn perimeter(rectangle: &Rectangle) -> u32 { - 21 (rectangle.width + rectangle.height) * 2 - 22 } + 1 /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 "The perimeter of the rectangle is {} pixels.", + 12 perimeter(&rect1) + 13 ); + 14 println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + 21 fn perimeter(rectangle: &Rectangle) -> u32 { + 22 (rectangle.width + rectangle.height) * 2 + 23 } diff --git a/tests/snapshots/output/numbers_rule.snapshot.txt b/tests/snapshots/output/numbers_rule.snapshot.txt index c1341d29df..560e755702 100644 --- a/tests/snapshots/output/numbers_rule.snapshot.txt +++ b/tests/snapshots/output/numbers_rule.snapshot.txt @@ -1,22 +1,23 @@ - 1 struct Rectangle { - 2 width: u32, - 3 height: u32, - 4 } - 5 - 6 fn main() { - 7 let rect1 = Rectangle { width: 30, height: 50 }; - 8 - 9 println!( - 10 "The perimeter of the rectangle is {} pixels.", - 11 perimeter(&rect1) - 12 ); - 13 println!(r#"This line contains invalid utf8: "�����"#; - 14 } - 15 - 16 fn area(rectangle: &Rectangle) -> u32 { - 17 rectangle.width * rectangle.height - 18 } - 19 - 20 fn perimeter(rectangle: &Rectangle) -> u32 { - 21 (rectangle.width + rectangle.height) * 2 - 22 } + 1 /// A rectangle. First line is changed to prevent a regression of #1869 + 2 struct Rectangle { + 3 width: u32, + 4 height: u32, + 5 } + 6 + 7 fn main() { + 8 let rect1 = Rectangle { width: 30, height: 50 }; + 9 + 10 println!( + 11 "The perimeter of the rectangle is {} pixels.", + 12 perimeter(&rect1) + 13 ); + 14 println!(r#"This line contains invalid utf8: "�����"#; + 15 } + 16 + 17 fn area(rectangle: &Rectangle) -> u32 { + 18 rectangle.width * rectangle.height + 19 } + 20 + 21 fn perimeter(rectangle: &Rectangle) -> u32 { + 22 (rectangle.width + rectangle.height) * 2 + 23 } diff --git a/tests/snapshots/output/plain.snapshot.txt b/tests/snapshots/output/plain.snapshot.txt index dbc49f9fdd..b9da99a904 100644 --- a/tests/snapshots/output/plain.snapshot.txt +++ b/tests/snapshots/output/plain.snapshot.txt @@ -1,3 +1,4 @@ +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/rule.snapshot.txt b/tests/snapshots/output/rule.snapshot.txt index dbc49f9fdd..b9da99a904 100644 --- a/tests/snapshots/output/rule.snapshot.txt +++ b/tests/snapshots/output/rule.snapshot.txt @@ -1,3 +1,4 @@ +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/sample.modified.rs b/tests/snapshots/sample.modified.rs index bb1a794375..fff9f98213 100644 --- a/tests/snapshots/sample.modified.rs +++ b/tests/snapshots/sample.modified.rs @@ -1,3 +1,4 @@ +/// A rectangle. First line is changed to prevent a regression of #1869 struct Rectangle { width: u32, height: u32,