@@ -22,37 +22,37 @@ enum FileType {
2222}
2323
2424impl FileType {
25- fn from_path ( path : & path:: Path , follow : bool ) -> io:: Result < FileType > {
25+ fn from_path ( path : & path:: Path , follow : bool ) -> io:: Result < Self > {
2626 let file_type = if follow {
2727 path. metadata ( )
2828 } else {
2929 path. symlink_metadata ( )
3030 } ?
3131 . file_type ( ) ;
3232 if file_type. is_dir ( ) {
33- return Ok ( FileType :: Dir ) ;
33+ return Ok ( Self :: Dir ) ;
3434 }
3535 if file_type. is_file ( ) {
36- return Ok ( FileType :: File ) ;
36+ return Ok ( Self :: File ) ;
3737 }
38- Ok ( FileType :: Symlink )
38+ Ok ( Self :: Symlink )
3939 }
4040
4141 fn eval ( self , ft : fs:: FileType ) -> bool {
4242 match self {
43- FileType :: File => ft. is_file ( ) ,
44- FileType :: Dir => ft. is_dir ( ) ,
45- FileType :: Symlink => ft. is_symlink ( ) ,
43+ Self :: File => ft. is_file ( ) ,
44+ Self :: Dir => ft. is_dir ( ) ,
45+ Self :: Symlink => ft. is_symlink ( ) ,
4646 }
4747 }
4848}
4949
5050impl fmt:: Display for FileType {
5151 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
5252 let t = match * self {
53- FileType :: File => "file" ,
54- FileType :: Dir => "dir" ,
55- FileType :: Symlink => "symlink" ,
53+ Self :: File => "file" ,
54+ Self :: Dir => "dir" ,
55+ Self :: Symlink => "symlink" ,
5656 } ;
5757 write ! ( f, "{t}" )
5858 }
@@ -79,8 +79,8 @@ impl FileTypePredicate {
7979 }
8080
8181 /// Allow to create an `FileTypePredicate` from a `path`
82- pub fn from_path ( path : & path:: Path ) -> io:: Result < FileTypePredicate > {
83- Ok ( FileTypePredicate {
82+ pub fn from_path ( path : & path:: Path ) -> io:: Result < Self > {
83+ Ok ( Self {
8484 ft : FileType :: from_path ( path, true ) ?,
8585 follow : true ,
8686 } )
0 commit comments