File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -4337,7 +4337,7 @@ fn $0fun_name(a: _) -> _ {
4337
4337
}
4338
4338
4339
4339
#[ test]
4340
- fn test_jeroen ( ) {
4340
+ fn reference_mutable_param_with_further_usages ( ) {
4341
4341
check_assist (
4342
4342
extract_function,
4343
4343
r#"
@@ -4365,6 +4365,37 @@ pub fn testfn(arg: &mut Foo) {
4365
4365
println!("{}", arg.field); // read access
4366
4366
}
4367
4367
4368
+ fn $0fun_name(arg: &mut Foo) {
4369
+ arg.field = 8;
4370
+ println!("{}", arg.field);
4371
+ }
4372
+ "# ,
4373
+ ) ;
4374
+ }
4375
+
4376
+ #[ test]
4377
+ fn reference_mutable_param_without_further_usages ( ) {
4378
+ check_assist (
4379
+ extract_function,
4380
+ r#"
4381
+ pub struct Foo {
4382
+ field: u32,
4383
+ }
4384
+
4385
+ pub fn testfn(arg: &mut Foo) {
4386
+ $0arg.field = 8; // write access
4387
+ println!("{}", arg.field); // read access$0
4388
+ }
4389
+ "# ,
4390
+ r#"
4391
+ pub struct Foo {
4392
+ field: u32,
4393
+ }
4394
+
4395
+ pub fn testfn(arg: &mut Foo) {
4396
+ fun_name(arg); // read access
4397
+ }
4398
+
4368
4399
fn $0fun_name(arg: &mut Foo) {
4369
4400
arg.field = 8;
4370
4401
println!("{}", arg.field);
You can’t perform that action at this time.
0 commit comments