From 64a49589e74447da668bd5acab8375206a10253f Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Sat, 27 Jun 2020 20:34:21 +1000 Subject: 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). --- crates/ra_ssr/src/matching.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_ssr/src/matching.rs') 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 { "1+2" ); - let edit = crate::replacing::matches_to_edit(&matches); + let edit = crate::replacing::matches_to_edit(&matches, input); let mut after = input.to_string(); edit.apply(&mut after); assert_eq!(after, "fn main() { bar(1+2); }"); -- cgit v1.2.3