diff options
| author | Ivan Komarov <Ivan.Komarov@dfyz.info> | 2018-10-27 04:01:37 +0300 |
|---|---|---|
| committer | Ivan Komarov <Ivan.Komarov@dfyz.info> | 2018-10-28 02:37:55 +0300 |
| commit | 00a20bceff40e98034a7346e5cc6319cbd2d21b7 (patch) | |
| tree | 45fedd13dfb41b1187ca3754aca8877c587ca44f /src | |
| parent | 8fb1b179bf26e15f8552e24a7600bf605f06c3a5 (diff) | |
Fix formatting failures on Windows
When newline_style is set to Windows, an empty line inside of a macro results in `\r` being passed to the `fold()` in `MacroBranch::rewrite()`. `\r` is technically not an empty string, so we try to indent it, leaving trailing whitespaces behind, even though that was not intended (as far as I can see). This commit replaces the `!l.is_empty()` check with calling `is_empty_line()`, since trying to indent any whitespace-only string will probably result in problematic trailing whitespaces. Fixes: #2810
Diffstat (limited to 'src')
| -rw-r--r-- | src/macros.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/macros.rs b/src/macros.rs index d378bb8ffb1..43f3071b70a 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1347,7 +1347,7 @@ impl MacroBranch { .fold( (String::new(), true), |(mut s, need_indent), (i, (kind, ref l))| { - if !l.is_empty() + if !is_empty_line(l) && need_indent && !new_body_snippet.is_line_non_formatted(i + 1) { |
