mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
Don't swallow trailing whitespace
This commit is contained in:
parent
07a168b6e4
commit
ef1801ac80
2 changed files with 7 additions and 6 deletions
|
|
@ -77,12 +77,8 @@ impl<'r, 'a> Inflate<'a> for DeflatedModule<'r, 'a> {
|
|||
}
|
||||
}
|
||||
if let Some(num) = last_indented {
|
||||
if num + 1 == footer.len() {
|
||||
footer = vec![];
|
||||
} else {
|
||||
let (_, rest) = footer.split_at(num + 1);
|
||||
footer = rest.to_vec();
|
||||
}
|
||||
let (_, rest) = footer.split_at(num);
|
||||
footer = rest.to_vec();
|
||||
}
|
||||
} else {
|
||||
swap(&mut header, &mut footer);
|
||||
|
|
|
|||
5
native/libcst/tests/fixtures/trailing_whitespace.py
vendored
Normal file
5
native/libcst/tests/fixtures/trailing_whitespace.py
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
x = 42
|
||||
print(x)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue