diff options
author | David Lattimore <[email protected]> | 2020-06-27 11:34:21 +0100 |
---|---|---|
committer | David Lattimore <[email protected]> | 2020-06-27 11:38:31 +0100 |
commit | 64a49589e74447da668bd5acab8375206a10253f (patch) | |
tree | d8520baa999ebc1a3dc72030d64799634a4a63c7 /crates/ra_ssr/src/matching.rs | |
parent | b081018363a210ffa0b95a4d3350a0a3e9b0cd83 (diff) |
Fix handling of whitespace when applying SSR within macro expansions.
I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).
Diffstat (limited to 'crates/ra_ssr/src/matching.rs')
-rw-r--r-- | crates/ra_ssr/src/matching.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index 85420ed3c..bb87bda43 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs | |||
@@ -585,7 +585,7 @@ mod tests { | |||
585 | "1+2" | 585 | "1+2" |
586 | ); | 586 | ); |
587 | 587 | ||
588 | let edit = crate::replacing::matches_to_edit(&matches); | 588 | let edit = crate::replacing::matches_to_edit(&matches, input); |
589 | let mut after = input.to_string(); | 589 | let mut after = input.to_string(); |
590 | edit.apply(&mut after); | 590 | edit.apply(&mut after); |
591 | assert_eq!(after, "fn main() { bar(1+2); }"); | 591 | assert_eq!(after, "fn main() { bar(1+2); }"); |