File tree Expand file tree Collapse file tree 1 file changed +68
-2
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +68
-2
lines changed Original file line number Diff line number Diff line change @@ -1139,7 +1139,7 @@ fn foo(s: S) {
1139
1139
}
1140
1140
1141
1141
#[ test]
1142
- fn test_extract_var_reference_local ( ) {
1142
+ fn test_extract_var_mutable_reference_local ( ) {
1143
1143
check_assist (
1144
1144
extract_variable,
1145
1145
r#"
@@ -1198,7 +1198,73 @@ impl X {
1198
1198
1199
1199
fn foo() {
1200
1200
let local = &mut S::new();
1201
- let $0x = local.sub;
1201
+ let $0x = &mut local.sub;
1202
+ x.do_thing();
1203
+ }"# ,
1204
+ ) ;
1205
+ }
1206
+
1207
+ #[ test]
1208
+ fn test_extract_var_reference_local ( ) {
1209
+ check_assist (
1210
+ extract_variable,
1211
+ r#"
1212
+ struct X;
1213
+
1214
+ struct S {
1215
+ sub: X
1216
+ }
1217
+
1218
+ impl S {
1219
+ fn new() -> S {
1220
+ S {
1221
+ sub: X::new()
1222
+ }
1223
+ }
1224
+ }
1225
+
1226
+ impl X {
1227
+ fn new() -> X {
1228
+ X { }
1229
+ }
1230
+ fn do_thing(&self) {
1231
+
1232
+ }
1233
+ }
1234
+
1235
+
1236
+ fn foo() {
1237
+ let local = &S::new();
1238
+ $0local.sub$0.do_thing();
1239
+ }"# ,
1240
+ r#"
1241
+ struct X;
1242
+
1243
+ struct S {
1244
+ sub: X
1245
+ }
1246
+
1247
+ impl S {
1248
+ fn new() -> S {
1249
+ S {
1250
+ sub: X::new()
1251
+ }
1252
+ }
1253
+ }
1254
+
1255
+ impl X {
1256
+ fn new() -> X {
1257
+ X { }
1258
+ }
1259
+ fn do_thing(&self) {
1260
+
1261
+ }
1262
+ }
1263
+
1264
+
1265
+ fn foo() {
1266
+ let local = &S::new();
1267
+ let $0x = &local.sub;
1202
1268
x.do_thing();
1203
1269
}"# ,
1204
1270
) ;
You can’t perform that action at this time.
0 commit comments