Commit b569d5f
committed
Bug 1982798 - Prevent extraneous empty lines from being added to Cargo.toml when regenerating it. r=tobyp
It's a simple fix but it took me some time to fully understand why this is
happening. `tomlkit.TOMLFile.read()` preserves whitespaces (including empty
lines) when parsing a TOML file (so it can reproduce them if it needs to turn
the `TOMLFile` into a string). However, our template adds two line breaks at the
end of the `[features]` section (to separate it from the following `[workspace]`
section). Which are then reproduced endlessly.
I'm not entirely sure why it started happening at the time it did, but I suspect
this might have something to do with
python-poetry/tomlkit#421 or
python-poetry/tomlkit#422 (although I'm not 100% certain
since it doesn't entirely match what I saw when I was fiddling with the
tomlkit source code to investigate this). Both these changes shipped in
tomlkit 0.13.3 which released in early June, which is a couple of weeks before
this issue started happening.
Anyway, the right thing to do in our case seems to strip the extra line breaks
since we already take care of adding them in the template.
Differential Revision: https://phabricator.services.mozilla.com/D260963
--HG--
extra : amend_source : 4e9a682977b07aca8162951e5ce170534dc7f1f31 parent 656bc06 commit b569d5f
2 files changed
Lines changed: 5 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
510 | 514 | | |
511 | 515 | | |
512 | 516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 11 | | |
70 | 12 | | |
71 | 13 | | |
| |||
0 commit comments