@@ -452,8 +452,10 @@ impl GenericPath for PosixPath {
452
452
components. push ( s. to_owned ( ) )
453
453
}
454
454
let is_absolute = ( s. len ( ) != 0 && s[ 0 ] == '/' as u8 ) ;
455
- return PosixPath { is_absolute : is_absolute,
456
- components : components }
455
+ PosixPath {
456
+ is_absolute : is_absolute,
457
+ components : components,
458
+ }
457
459
}
458
460
459
461
fn dirname ( & self ) -> ~str {
@@ -466,40 +468,40 @@ impl GenericPath for PosixPath {
466
468
467
469
fn filename ( & self ) -> Option < ~str > {
468
470
match self . components . len ( ) {
469
- 0 => None ,
470
- n => Some ( copy self . components [ n - 1 ] )
471
+ 0 => None ,
472
+ n => Some ( copy self . components [ n - 1 ] ) ,
471
473
}
472
474
}
473
475
474
476
fn filestem ( & self ) -> Option < ~str > {
475
477
match self . filename ( ) {
476
- None => None ,
477
- Some ( ref f) => {
478
- match str:: rfind_char ( * f, '.' ) {
479
- Some ( p) => Some ( f. slice ( 0 , p) . to_owned ( ) ) ,
480
- None => Some ( copy * f)
478
+ None => None ,
479
+ Some ( ref f) => {
480
+ match str:: rfind_char ( * f, '.' ) {
481
+ Some ( p) => Some ( f. slice ( 0 , p) . to_owned ( ) ) ,
482
+ None => Some ( copy * f) ,
483
+ }
481
484
}
482
- }
483
485
}
484
486
}
485
487
486
488
fn filetype ( & self ) -> Option < ~str > {
487
489
match self . filename ( ) {
488
- None => None ,
489
- Some ( ref f) => {
490
- match str:: rfind_char ( * f, '.' ) {
491
- Some ( p) if p < f. len ( ) => Some ( f. slice ( p, f. len ( ) ) . to_owned ( ) ) ,
492
- _ => None
490
+ None => None ,
491
+ Some ( ref f) => {
492
+ match str:: rfind_char ( * f, '.' ) {
493
+ Some ( p) if p < f. len ( ) => Some ( f. slice ( p, f. len ( ) ) . to_owned ( ) ) ,
494
+ _ => None ,
495
+ }
493
496
}
494
- }
495
497
}
496
498
}
497
499
498
500
fn with_dirname ( & self , d : & str ) -> PosixPath {
499
501
let dpath = PosixPath ( d) ;
500
502
match self . filename ( ) {
501
- Some ( ref f) => dpath. push ( * f) ,
502
- None => dpath
503
+ Some ( ref f) => dpath. push ( * f) ,
504
+ None => dpath,
503
505
}
504
506
}
505
507
@@ -510,8 +512,8 @@ impl GenericPath for PosixPath {
510
512
511
513
fn with_filestem ( & self , s : & str ) -> PosixPath {
512
514
match self . filetype ( ) {
513
- None => self . with_filename ( s) ,
514
- Some ( ref t) => self . with_filename ( str:: to_owned ( s) + * t)
515
+ None => self . with_filename ( s) ,
516
+ Some ( ref t) => self . with_filename ( str:: to_owned ( s) + * t) ,
515
517
}
516
518
}
517
519
@@ -536,8 +538,10 @@ impl GenericPath for PosixPath {
536
538
None => ~[ ] ,
537
539
Some ( ref f) => ~[ copy * f]
538
540
} ;
539
- return PosixPath { is_absolute : false ,
540
- components : cs }
541
+ PosixPath {
542
+ is_absolute : false ,
543
+ components : cs,
544
+ }
541
545
}
542
546
543
547
fn push_rel ( & self , other : & PosixPath ) -> PosixPath {
@@ -547,8 +551,10 @@ impl GenericPath for PosixPath {
547
551
548
552
fn unsafe_join ( & self , other : & PosixPath ) -> PosixPath {
549
553
if other. is_absolute {
550
- PosixPath { is_absolute : true ,
551
- components : copy other. components }
554
+ PosixPath {
555
+ is_absolute : true ,
556
+ components : copy other. components ,
557
+ }
552
558
} else {
553
559
self . push_rel ( other)
554
560
}
@@ -567,8 +573,10 @@ impl GenericPath for PosixPath {
567
573
}
568
574
v. push_all_move ( ss) ;
569
575
}
570
- PosixPath { is_absolute : self . is_absolute ,
571
- components : v }
576
+ PosixPath {
577
+ is_absolute : self . is_absolute ,
578
+ components : v,
579
+ }
572
580
}
573
581
574
582
fn push ( & self , s : & str ) -> PosixPath {
@@ -586,19 +594,17 @@ impl GenericPath for PosixPath {
586
594
if cs. len ( ) != 0 {
587
595
cs. pop ( ) ;
588
596
}
589
- return PosixPath {
597
+ PosixPath {
590
598
is_absolute : self . is_absolute ,
591
- components : cs
592
- }
593
- //..self }
599
+ components : cs,
600
+ } //..self }
594
601
}
595
602
596
603
fn normalize ( & self ) -> PosixPath {
597
- return PosixPath {
604
+ PosixPath {
598
605
is_absolute : self . is_absolute ,
599
- components : normalize ( self . components )
600
- // ..self
601
- }
606
+ components : normalize ( self . components ) ,
607
+ } // ..self }
602
608
}
603
609
604
610
fn is_absolute ( & self ) -> bool {
@@ -658,10 +664,12 @@ impl GenericPath for WindowsPath {
658
664
components. push ( s. to_owned ( ) )
659
665
}
660
666
let is_absolute = ( rest. len ( ) != 0 && windows:: is_sep ( rest[ 0 ] ) ) ;
661
- return WindowsPath { host : host,
662
- device : device,
663
- is_absolute : is_absolute,
664
- components : components }
667
+ WindowsPath {
668
+ host : host,
669
+ device : device,
670
+ is_absolute : is_absolute,
671
+ components : components,
672
+ }
665
673
}
666
674
667
675
fn dirname ( & self ) -> ~str {
@@ -674,20 +682,20 @@ impl GenericPath for WindowsPath {
674
682
675
683
fn filename ( & self ) -> Option < ~str > {
676
684
match self . components . len ( ) {
677
- 0 => None ,
678
- n => Some ( copy self . components [ n - 1 ] )
685
+ 0 => None ,
686
+ n => Some ( copy self . components [ n - 1 ] ) ,
679
687
}
680
688
}
681
689
682
690
fn filestem ( & self ) -> Option < ~str > {
683
691
match self . filename ( ) {
684
- None => None ,
685
- Some ( ref f) => {
686
- match str:: rfind_char ( * f, '.' ) {
687
- Some ( p) => Some ( f. slice ( 0 , p) . to_owned ( ) ) ,
688
- None => Some ( copy * f)
692
+ None => None ,
693
+ Some ( ref f) => {
694
+ match str:: rfind_char ( * f, '.' ) {
695
+ Some ( p) => Some ( f. slice ( 0 , p) . to_owned ( ) ) ,
696
+ None => Some ( copy * f) ,
697
+ }
689
698
}
690
- }
691
699
}
692
700
}
693
701
@@ -696,8 +704,8 @@ impl GenericPath for WindowsPath {
696
704
None => None ,
697
705
Some ( ref f) => {
698
706
match str:: rfind_char ( * f, '.' ) {
699
- Some ( p) if p < f. len ( ) => Some ( f. slice ( p, f. len ( ) ) . to_owned ( ) ) ,
700
- _ => None
707
+ Some ( p) if p < f. len ( ) => Some ( f. slice ( p, f. len ( ) ) . to_owned ( ) ) ,
708
+ _ => None ,
701
709
}
702
710
}
703
711
}
@@ -706,8 +714,8 @@ impl GenericPath for WindowsPath {
706
714
fn with_dirname ( & self , d : & str ) -> WindowsPath {
707
715
let dpath = WindowsPath ( d) ;
708
716
match self . filename ( ) {
709
- Some ( ref f) => dpath. push ( * f) ,
710
- None => dpath
717
+ Some ( ref f) => dpath. push ( * f) ,
718
+ None => dpath,
711
719
}
712
720
}
713
721
@@ -718,8 +726,8 @@ impl GenericPath for WindowsPath {
718
726
719
727
fn with_filestem ( & self , s : & str ) -> WindowsPath {
720
728
match self . filetype ( ) {
721
- None => self . with_filename ( s) ,
722
- Some ( ref t) => self . with_filename ( str:: to_owned ( s) + * t)
729
+ None => self . with_filename ( s) ,
730
+ Some ( ref t) => self . with_filename ( str:: to_owned ( s) + * t) ,
723
731
}
724
732
}
725
733
@@ -740,14 +748,15 @@ impl GenericPath for WindowsPath {
740
748
}
741
749
742
750
fn file_path ( & self ) -> WindowsPath {
743
- let cs = match self . filename ( ) {
744
- None => ~[ ] ,
745
- Some ( ref f) => ~[ copy * f]
746
- } ;
747
- return WindowsPath { host : None ,
748
- device : None ,
749
- is_absolute : false ,
750
- components : cs }
751
+ WindowsPath {
752
+ host : None ,
753
+ device : None ,
754
+ is_absolute : false ,
755
+ components : match self . filename ( ) {
756
+ None => ~[ ] ,
757
+ Some ( ref f) => ~[ copy * f] ,
758
+ }
759
+ }
751
760
}
752
761
753
762
fn push_rel ( & self , other : & WindowsPath ) -> WindowsPath {
@@ -768,7 +777,7 @@ impl GenericPath for WindowsPath {
768
777
host : Some ( host) ,
769
778
device : copy other. device ,
770
779
is_absolute : true ,
771
- components : copy other. components
780
+ components : copy other. components ,
772
781
} ;
773
782
}
774
783
_ => { }
@@ -781,7 +790,7 @@ impl GenericPath for WindowsPath {
781
790
host : None ,
782
791
device : Some ( device) ,
783
792
is_absolute : true ,
784
- components : copy other. components
793
+ components : copy other. components ,
785
794
} ;
786
795
}
787
796
_ => { }
@@ -793,7 +802,7 @@ impl GenericPath for WindowsPath {
793
802
host : copy self . host ,
794
803
device : copy self . device ,
795
804
is_absolute : self . is_absolute || other. is_absolute ,
796
- components : copy other. components
805
+ components : copy other. components ,
797
806
}
798
807
}
799
808
@@ -822,7 +831,7 @@ impl GenericPath for WindowsPath {
822
831
v. push_all_move ( ss) ;
823
832
}
824
833
// tedious, but as-is, we can't use ..self
825
- return WindowsPath {
834
+ WindowsPath {
826
835
host : copy self . host ,
827
836
device : copy self . device ,
828
837
is_absolute : self . is_absolute ,
@@ -837,24 +846,24 @@ impl GenericPath for WindowsPath {
837
846
ss. push ( s. to_owned ( ) )
838
847
}
839
848
v. push_all_move ( ss) ;
840
- return WindowsPath { components : v, ..copy * self }
849
+ WindowsPath { components : v, ..copy * self }
841
850
}
842
851
843
852
fn pop ( & self ) -> WindowsPath {
844
853
let mut cs = copy self . components ;
845
854
if cs. len ( ) != 0 {
846
855
cs. pop ( ) ;
847
856
}
848
- return WindowsPath {
857
+ WindowsPath {
849
858
host : copy self . host ,
850
859
device : copy self . device ,
851
860
is_absolute : self . is_absolute ,
852
- components : cs
861
+ components : cs,
853
862
}
854
863
}
855
864
856
865
fn normalize ( & self ) -> WindowsPath {
857
- return WindowsPath {
866
+ WindowsPath {
858
867
host : copy self . host ,
859
868
device : match self . device {
860
869
None => None ,
0 commit comments