Commit de42a17
committed
Simplify test case for issue 5023
By replacing the code quoted from the issue with a single comment that
more directly exposes the issue. This is to
1. Make the underlying issue easier to reason about
2. Make this test not behave upon the behaviour of indentation length
when rewriting lines (my main motivation for this change, since it
makes the followup patch simpler)
This was tested by partially reverting
368a9b7 with the patch:
```patch
diff --git i/src/string.rs w/src/string.rs
index 3b97118..561e70ac 100644
--- i/src/string.rs
+++ w/src/string.rs
@@ -278,9 +278,6 @@ fn break_string(max_width: usize, trim_end: bool, line_end: &str, input: &[&str]
}
cur_index
};
- if max_width_index_in_input == 0 {
- return SnippetState::EndOfInput(input.concat());
- }
// Find the position in input for breaking the string
if line_end.is_empty()
```
The re-running tests, or executing `rustmft` directly on this test,
triggered the panic from the original bug.1 parent 461e7b1 commit de42a17
2 files changed
+23
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
3 | 13 | | |
4 | 14 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
3 | 14 | | |
4 | 15 | | |
5 | 16 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 17 | + | |
0 commit comments