@@ -3,7 +3,6 @@ use std::io::Write;
33use std:: path:: PathBuf ;
44
55use crate :: dist:: DEFAULT_DIST_SERVER ;
6- use crate :: dist:: Notification ;
76use crate :: dist:: component:: Transaction ;
87use crate :: dist:: prefix:: InstallPrefix ;
98use crate :: dist:: temp;
@@ -24,9 +23,8 @@ fn add_file() {
2423 Box :: new ( |_| ( ) ) ,
2524 ) ;
2625
27- let notify = |_: Notification < ' _ > | ( ) ;
2826 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 ) ;
3028
3129 let mut file = tx. add_file ( "c" , PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
3230 write ! ( file, "test" ) . unwrap ( ) ;
@@ -53,9 +51,8 @@ fn add_file_then_rollback() {
5351 Box :: new ( |_| ( ) ) ,
5452 ) ;
5553
56- let notify = |_: Notification < ' _ > | ( ) ;
5754 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 ) ;
5956
6057 tx. add_file ( "c" , PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
6158 drop ( tx) ;
@@ -76,9 +73,8 @@ fn add_file_that_exists() {
7673
7774 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
7875
79- let notify = |_: Notification < ' _ > | ( ) ;
8076 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 ) ;
8278
8379 fs:: create_dir_all ( prefixdir. path ( ) . join ( "foo" ) ) . unwrap ( ) ;
8480 utils:: write_file ( "" , & prefixdir. path ( ) . join ( "foo/bar" ) , "" ) . unwrap ( ) ;
@@ -108,9 +104,8 @@ fn copy_file() {
108104
109105 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
110106
111- let notify = |_: Notification < ' _ > | ( ) ;
112107 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 ) ;
114109
115110 let srcpath = srcdir. path ( ) . join ( "bar" ) ;
116111 utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -136,9 +131,8 @@ fn copy_file_then_rollback() {
136131
137132 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
138133
139- let notify = |_: Notification < ' _ > | ( ) ;
140134 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 ) ;
142136
143137 let srcpath = srcdir. path ( ) . join ( "bar" ) ;
144138 utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -164,9 +158,8 @@ fn copy_file_that_exists() {
164158
165159 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
166160
167- let notify = |_: Notification < ' _ > | ( ) ;
168161 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 ) ;
170163
171164 let srcpath = srcdir. path ( ) . join ( "bar" ) ;
172165 utils:: write_file ( "" , & srcpath, "" ) . unwrap ( ) ;
@@ -201,9 +194,8 @@ fn copy_dir() {
201194
202195 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
203196
204- let notify = |_: Notification < ' _ > | ( ) ;
205197 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 ) ;
207199
208200 let srcpath1 = srcdir. path ( ) . join ( "foo" ) ;
209201 let srcpath2 = srcdir. path ( ) . join ( "bar/baz" ) ;
@@ -236,9 +228,8 @@ fn copy_dir_then_rollback() {
236228
237229 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
238230
239- let notify = |_: Notification < ' _ > | ( ) ;
240231 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 ) ;
242233
243234 let srcpath1 = srcdir. path ( ) . join ( "foo" ) ;
244235 let srcpath2 = srcdir. path ( ) . join ( "bar/baz" ) ;
@@ -271,9 +262,8 @@ fn copy_dir_that_exists() {
271262
272263 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
273264
274- let notify = |_: Notification < ' _ > | ( ) ;
275265 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 ) ;
277267
278268 fs:: create_dir_all ( prefix. path ( ) . join ( "a" ) ) . unwrap ( ) ;
279269
@@ -303,9 +293,8 @@ fn remove_file() {
303293
304294 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
305295
306- let notify = |_: Notification < ' _ > | ( ) ;
307296 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 ) ;
309298
310299 let filepath = prefixdir. path ( ) . join ( "foo" ) ;
311300 utils:: write_file ( "" , & filepath, "" ) . unwrap ( ) ;
@@ -329,9 +318,8 @@ fn remove_file_then_rollback() {
329318
330319 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
331320
332- let notify = |_: Notification < ' _ > | ( ) ;
333321 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 ) ;
335323
336324 let filepath = prefixdir. path ( ) . join ( "foo" ) ;
337325 utils:: write_file ( "" , & filepath, "" ) . unwrap ( ) ;
@@ -355,9 +343,8 @@ fn remove_file_that_not_exists() {
355343
356344 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
357345
358- let notify = |_: Notification < ' _ > | ( ) ;
359346 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 ) ;
361348
362349 let err = tx. remove_file ( "c" , PathBuf :: from ( "foo" ) ) . unwrap_err ( ) ;
363350
@@ -383,9 +370,8 @@ fn remove_dir() {
383370
384371 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
385372
386- let notify = |_: Notification < ' _ > | ( ) ;
387373 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 ) ;
389375
390376 let filepath = prefixdir. path ( ) . join ( "foo/bar" ) ;
391377 fs:: create_dir_all ( filepath. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -410,9 +396,8 @@ fn remove_dir_then_rollback() {
410396
411397 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
412398
413- let notify = |_: Notification < ' _ > | ( ) ;
414399 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 ) ;
416401
417402 let filepath = prefixdir. path ( ) . join ( "foo/bar" ) ;
418403 fs:: create_dir_all ( filepath. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -437,9 +422,8 @@ fn remove_dir_that_not_exists() {
437422
438423 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
439424
440- let notify = |_: Notification < ' _ > | ( ) ;
441425 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 ) ;
443427
444428 let err = tx. remove_dir ( "c" , PathBuf :: from ( "foo" ) ) . unwrap_err ( ) ;
445429
@@ -465,9 +449,8 @@ fn write_file() {
465449
466450 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
467451
468- let notify = |_: Notification < ' _ > | ( ) ;
469452 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 ) ;
471454
472455 let content = "hi" . to_string ( ) ;
473456 tx. write_file ( "c" , PathBuf :: from ( "foo/bar" ) , content. clone ( ) )
@@ -493,9 +476,8 @@ fn write_file_then_rollback() {
493476
494477 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
495478
496- let notify = |_: Notification < ' _ > | ( ) ;
497479 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 ) ;
499481
500482 let content = "hi" . to_string ( ) ;
501483 tx. write_file ( "c" , PathBuf :: from ( "foo/bar" ) , content)
@@ -518,9 +500,8 @@ fn write_file_that_exists() {
518500
519501 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
520502
521- let notify = |_: Notification < ' _ > | ( ) ;
522503 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 ) ;
524505
525506 let content = "hi" . to_string ( ) ;
526507 utils_raw:: write_file ( & prefix. path ( ) . join ( "a" ) , & content) . unwrap ( ) ;
@@ -550,9 +531,8 @@ fn modify_file_that_not_exists() {
550531
551532 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
552533
553- let notify = |_: Notification < ' _ > | ( ) ;
554534 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 ) ;
556536
557537 tx. modify_file ( PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
558538 tx. commit ( ) ;
@@ -575,9 +555,8 @@ fn modify_file_that_exists() {
575555
576556 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
577557
578- let notify = |_: Notification < ' _ > | ( ) ;
579558 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 ) ;
581560
582561 let path = prefix. path ( ) . join ( "foo" ) ;
583562 utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -600,9 +579,8 @@ fn modify_file_that_not_exists_then_rollback() {
600579
601580 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
602581
603- let notify = |_: Notification < ' _ > | ( ) ;
604582 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 ) ;
606584
607585 tx. modify_file ( PathBuf :: from ( "foo/bar" ) ) . unwrap ( ) ;
608586 drop ( tx) ;
@@ -623,9 +601,8 @@ fn modify_file_that_exists_then_rollback() {
623601
624602 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
625603
626- let notify = |_: Notification < ' _ > | ( ) ;
627604 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 ) ;
629606
630607 let path = prefix. path ( ) . join ( "foo" ) ;
631608 utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -651,9 +628,8 @@ fn modify_twice_then_rollback() {
651628
652629 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
653630
654- let notify = |_: Notification < ' _ > | ( ) ;
655631 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 ) ;
657633
658634 let path = prefix. path ( ) . join ( "foo" ) ;
659635 utils_raw:: write_file ( & path, "wow" ) . unwrap ( ) ;
@@ -679,9 +655,8 @@ fn do_multiple_op_transaction(rollback: bool) {
679655
680656 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
681657
682- let notify = |_: Notification < ' _ > | ( ) ;
683658 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 ) ;
685660
686661 // copy_file
687662 let relpath1 = PathBuf :: from ( "bin/rustc" ) ;
@@ -781,9 +756,8 @@ fn rollback_failure_keeps_going() {
781756
782757 let prefix = InstallPrefix :: from ( prefixdir. path ( ) ) ;
783758
784- let notify = |_: Notification < ' _ > | ( ) ;
785759 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 ) ;
787761
788762 write ! ( tx. add_file( "" , PathBuf :: from( "foo" ) ) . unwrap( ) , "" ) . unwrap ( ) ;
789763 write ! ( tx. add_file( "" , PathBuf :: from( "bar" ) ) . unwrap( ) , "" ) . unwrap ( ) ;
0 commit comments