Unnamed repository; edit this file 'description' to name the repository.
Add test for renaming pattern match with ref
BramVerb 11 days ago
parent a64d503 · commit 2d300e0
-rw-r--r--crates/ide/src/rename.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs
index 5d86ad5077..802c6de25f 100644
--- a/crates/ide/src/rename.rs
+++ b/crates/ide/src/rename.rs
@@ -4126,4 +4126,50 @@ pub fn main() {
"#,
);
}
+ #[test]
+ fn test_rename_ref_pattern_with_macro() {
+ check(
+ "new",
+ r#"
+macro_rules! pat_macro {
+ ($pat:pat) => {
+ $pat
+ };
+}
+enum CustomOption<T> {
+ None,
+ Some(T),
+}
+
+pub fn main() {
+ match CustomOption::None {
+ pat_macro!(CustomOption::Some(ref old$0)) => {
+ old += 1,
+ }
+ None => {}
+ }
+}
+"#,
+ r#"
+macro_rules! pat_macro {
+ ($pat:pat) => {
+ $pat
+ };
+}
+enum CustomOption<T> {
+ None,
+ Some(T),
+}
+
+pub fn main() {
+ match CustomOption::None {
+ pat_macro!(CustomOption::Some(ref new)) => {
+ new += 1,
+ }
+ None => {}
+ }
+}
+"#,
+ );
+ }
}