@@ -3,7 +3,6 @@ use std::io::Write;
3
3
use std:: path:: PathBuf ;
4
4
5
5
use crate :: dist:: DEFAULT_DIST_SERVER ;
6
- use crate :: dist:: Notification ;
7
6
use crate :: dist:: component:: Transaction ;
8
7
use crate :: dist:: prefix:: InstallPrefix ;
9
8
use crate :: dist:: temp;
@@ -24,9 +23,8 @@ fn add_file() {
24
23
Box :: new ( |_| ( ) ) ,
25
24
) ;
26
25
27
- let notify = |_: Notification < ' _ > | ( ) ;
28
26
let tp = TestProcess :: default ( ) ;
29
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
27
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
30
28
31
29
let mut file = tx. add_file ( "c" , PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
32
30
write ! ( file, "test" ) . unwrap ( ) ;
@@ -53,9 +51,8 @@ fn add_file_then_rollback() {
53
51
Box :: new ( |_| ( ) ) ,
54
52
) ;
55
53
56
- let notify = |_: Notification < ' _ > | ( ) ;
57
54
let tp = TestProcess :: default ( ) ;
58
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
55
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
59
56
60
57
tx. add_file ( "c" , PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
61
58
drop ( tx) ;
@@ -76,9 +73,8 @@ fn add_file_that_exists() {
76
73
77
74
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
78
75
79
- let notify = |_: Notification < ' _ > | ( ) ;
80
76
let tp = TestProcess :: default ( ) ;
81
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
77
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
82
78
83
79
fs:: create_dir_all ( prefixdir. path ( ) . join ( "foo" ) ) . unwrap ( ) ;
84
80
utils:: write_file ( "" , & prefixdir. path ( ) . join ( "foo/bar" ) , "" ) . unwrap ( ) ;
@@ -108,9 +104,8 @@ fn copy_file() {
108
104
109
105
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
110
106
111
- let notify = |_: Notification < ' _ > | ( ) ;
112
107
let tp = TestProcess :: default ( ) ;
113
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
108
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
114
109
115
110
let srcpath = srcdir. path ( ) . join ( "bar" ) ;
116
111
utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -136,9 +131,8 @@ fn copy_file_then_rollback() {
136
131
137
132
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
138
133
139
- let notify = |_: Notification < ' _ > | ( ) ;
140
134
let tp = TestProcess :: default ( ) ;
141
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
135
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
142
136
143
137
let srcpath = srcdir. path ( ) . join ( "bar" ) ;
144
138
utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -164,9 +158,8 @@ fn copy_file_that_exists() {
164
158
165
159
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
166
160
167
- let notify = |_: Notification < ' _ > | ( ) ;
168
161
let tp = TestProcess :: default ( ) ;
169
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
162
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
170
163
171
164
let srcpath = srcdir. path ( ) . join ( "bar" ) ;
172
165
utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -201,9 +194,8 @@ fn copy_dir() {
201
194
202
195
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
203
196
204
- let notify = |_: Notification < ' _ > | ( ) ;
205
197
let tp = TestProcess :: default ( ) ;
206
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
198
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
207
199
208
200
let srcpath1 = srcdir. path ( ) . join ( "foo" ) ;
209
201
let srcpath2 = srcdir. path ( ) . join ( "bar/baz" ) ;
@@ -236,9 +228,8 @@ fn copy_dir_then_rollback() {
236
228
237
229
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
238
230
239
- let notify = |_: Notification < ' _ > | ( ) ;
240
231
let tp = TestProcess :: default ( ) ;
241
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
232
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
242
233
243
234
let srcpath1 = srcdir. path ( ) . join ( "foo" ) ;
244
235
let srcpath2 = srcdir. path ( ) . join ( "bar/baz" ) ;
@@ -271,9 +262,8 @@ fn copy_dir_that_exists() {
271
262
272
263
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
273
264
274
- let notify = |_: Notification < ' _ > | ( ) ;
275
265
let tp = TestProcess :: default ( ) ;
276
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
266
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
277
267
278
268
fs:: create_dir_all ( prefix. path ( ) . join ( "a" ) ) . unwrap ( ) ;
279
269
@@ -303,9 +293,8 @@ fn remove_file() {
303
293
304
294
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
305
295
306
- let notify = |_: Notification < ' _ > | ( ) ;
307
296
let tp = TestProcess :: default ( ) ;
308
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
297
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
309
298
310
299
let filepath = prefixdir. path ( ) . join ( "foo" ) ;
311
300
utils:: write_file ( "" , & filepath, "" ) . unwrap ( ) ;
@@ -329,9 +318,8 @@ fn remove_file_then_rollback() {
329
318
330
319
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
331
320
332
- let notify = |_: Notification < ' _ > | ( ) ;
333
321
let tp = TestProcess :: default ( ) ;
334
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
322
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
335
323
336
324
let filepath = prefixdir. path ( ) . join ( "foo" ) ;
337
325
utils:: write_file ( "" , & filepath, "" ) . unwrap ( ) ;
@@ -355,9 +343,8 @@ fn remove_file_that_not_exists() {
355
343
356
344
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
357
345
358
- let notify = |_: Notification < ' _ > | ( ) ;
359
346
let tp = TestProcess :: default ( ) ;
360
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
347
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
361
348
362
349
let err = tx. remove_file ( "c" , PathBuf :: from ( "foo" ) ) . unwrap_err ( ) ;
363
350
@@ -383,9 +370,8 @@ fn remove_dir() {
383
370
384
371
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
385
372
386
- let notify = |_: Notification < ' _ > | ( ) ;
387
373
let tp = TestProcess :: default ( ) ;
388
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
374
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
389
375
390
376
let filepath = prefixdir. path ( ) . join ( "foo/bar" ) ;
391
377
fs:: create_dir_all ( filepath. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -410,9 +396,8 @@ fn remove_dir_then_rollback() {
410
396
411
397
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
412
398
413
- let notify = |_: Notification < ' _ > | ( ) ;
414
399
let tp = TestProcess :: default ( ) ;
415
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
400
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
416
401
417
402
let filepath = prefixdir. path ( ) . join ( "foo/bar" ) ;
418
403
fs:: create_dir_all ( filepath. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -437,9 +422,8 @@ fn remove_dir_that_not_exists() {
437
422
438
423
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
439
424
440
- let notify = |_: Notification < ' _ > | ( ) ;
441
425
let tp = TestProcess :: default ( ) ;
442
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
426
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
443
427
444
428
let err = tx. remove_dir ( "c" , PathBuf :: from ( "foo" ) ) . unwrap_err ( ) ;
445
429
@@ -465,9 +449,8 @@ fn write_file() {
465
449
466
450
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
467
451
468
- let notify = |_: Notification < ' _ > | ( ) ;
469
452
let tp = TestProcess :: default ( ) ;
470
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
453
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
471
454
472
455
let content = "hi" . to_string ( ) ;
473
456
tx. write_file ( "c" , PathBuf :: from ( "foo/bar" ) , content. clone ( ) )
@@ -493,9 +476,8 @@ fn write_file_then_rollback() {
493
476
494
477
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
495
478
496
- let notify = |_: Notification < ' _ > | ( ) ;
497
479
let tp = TestProcess :: default ( ) ;
498
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
480
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
499
481
500
482
let content = "hi" . to_string ( ) ;
501
483
tx. write_file ( "c" , PathBuf :: from ( "foo/bar" ) , content)
@@ -518,9 +500,8 @@ fn write_file_that_exists() {
518
500
519
501
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
520
502
521
- let notify = |_: Notification < ' _ > | ( ) ;
522
503
let tp = TestProcess :: default ( ) ;
523
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
504
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
524
505
525
506
let content = "hi" . to_string ( ) ;
526
507
utils_raw:: write_file ( & prefix. path ( ) . join ( "a" ) , & content) . unwrap ( ) ;
@@ -550,9 +531,8 @@ fn modify_file_that_not_exists() {
550
531
551
532
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
552
533
553
- let notify = |_: Notification < ' _ > | ( ) ;
554
534
let tp = TestProcess :: default ( ) ;
555
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
535
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
556
536
557
537
tx. modify_file ( PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
558
538
tx. commit ( ) ;
@@ -575,9 +555,8 @@ fn modify_file_that_exists() {
575
555
576
556
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
577
557
578
- let notify = |_: Notification < ' _ > | ( ) ;
579
558
let tp = TestProcess :: default ( ) ;
580
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
559
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
581
560
582
561
let path = prefix. path ( ) . join ( "foo" ) ;
583
562
utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -600,9 +579,8 @@ fn modify_file_that_not_exists_then_rollback() {
600
579
601
580
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
602
581
603
- let notify = |_: Notification < ' _ > | ( ) ;
604
582
let tp = TestProcess :: default ( ) ;
605
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
583
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
606
584
607
585
tx. modify_file ( PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
608
586
drop ( tx) ;
@@ -623,9 +601,8 @@ fn modify_file_that_exists_then_rollback() {
623
601
624
602
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
625
603
626
- let notify = |_: Notification < ' _ > | ( ) ;
627
604
let tp = TestProcess :: default ( ) ;
628
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
605
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
629
606
630
607
let path = prefix. path ( ) . join ( "foo" ) ;
631
608
utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -651,9 +628,8 @@ fn modify_twice_then_rollback() {
651
628
652
629
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
653
630
654
- let notify = |_: Notification < ' _ > | ( ) ;
655
631
let tp = TestProcess :: default ( ) ;
656
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
632
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
657
633
658
634
let path = prefix. path ( ) . join ( "foo" ) ;
659
635
utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -679,9 +655,8 @@ fn do_multiple_op_transaction(rollback: bool) {
679
655
680
656
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
681
657
682
- let notify = |_: Notification < ' _ > | ( ) ;
683
658
let tp = TestProcess :: default ( ) ;
684
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
659
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
685
660
686
661
// copy_file
687
662
let relpath1 = PathBuf :: from ( "bin/rustc" ) ;
@@ -781,9 +756,8 @@ fn rollback_failure_keeps_going() {
781
756
782
757
let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
783
758
784
- let notify = |_: Notification < ' _ > | ( ) ;
785
759
let tp = TestProcess :: default ( ) ;
786
- let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & notify , & tp. process ) ;
760
+ let mut tx = Transaction :: new ( prefix. clone ( ) , & tmp_cx, & |_| ( ) , & tp. process ) ;
787
761
788
762
write ! ( tx. add_file( "" , PathBuf :: from( "foo" ) ) . unwrap( ) , "" ) . unwrap ( ) ;
789
763
write ! ( tx. add_file( "" , PathBuf :: from( "bar" ) ) . unwrap( ) , "" ) . unwrap ( ) ;
0 commit comments