2
2
3
3
use std:: { env, fmt} ;
4
4
use std:: path:: PathBuf ;
5
+ use errors:: * ;
5
6
6
7
7
8
#[ derive( Clone ) ]
@@ -23,35 +24,6 @@ pub struct DocBuilderOptions {
23
24
24
25
25
26
26
- // This error only occurs if check_dirs fails
27
- pub enum DocBuilderPathError {
28
- DestinationPathNotExists ,
29
- ChrootPathNotExists ,
30
- BuildDirectoryNotExists ,
31
- CratesIoIndexPathNotExists ,
32
- LogsPathNotExists ,
33
- }
34
-
35
-
36
- impl fmt:: Debug for DocBuilderPathError {
37
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
38
- match * self {
39
- DocBuilderPathError :: DestinationPathNotExists =>
40
- write ! ( f, "Destination path not exists" ) ,
41
- DocBuilderPathError :: ChrootPathNotExists =>
42
- write ! ( f, "Chroot path not exists" ) ,
43
- DocBuilderPathError :: BuildDirectoryNotExists =>
44
- write ! ( f, "Build directory path not exists" ) ,
45
- DocBuilderPathError :: CratesIoIndexPathNotExists =>
46
- write ! ( f, "crates.io-index path not exists" ) ,
47
- DocBuilderPathError :: LogsPathNotExists =>
48
- write ! ( f, "Logs path not exists" ) ,
49
- }
50
- }
51
- }
52
-
53
-
54
-
55
27
impl Default for DocBuilderOptions {
56
28
fn default ( ) -> DocBuilderOptions {
57
29
@@ -120,18 +92,18 @@ impl DocBuilderOptions {
120
92
}
121
93
122
94
123
- pub fn check_paths ( & self ) -> Result < ( ) , DocBuilderPathError > {
95
+ pub fn check_paths ( & self ) -> Result < ( ) > {
124
96
if !self . destination . exists ( ) {
125
- return Err ( DocBuilderPathError :: DestinationPathNotExists )
97
+ return Err ( "Destination path not exists" . into ( ) )
126
98
}
127
99
if !self . chroot_path . exists ( ) {
128
- return Err ( DocBuilderPathError :: ChrootPathNotExists )
100
+ return Err ( "Chroot path not exists" . into ( ) )
129
101
}
130
102
if !self . crates_io_index_path . exists ( ) {
131
- return Err ( DocBuilderPathError :: CratesIoIndexPathNotExists )
103
+ return Err ( "crates.io-index path not exists" . into ( ) )
132
104
}
133
105
if !self . crates_io_index_path . exists ( ) {
134
- return Err ( DocBuilderPathError :: LogsPathNotExists )
106
+ return Err ( "Logs path not exists" . into ( ) )
135
107
}
136
108
Ok ( ( ) )
137
109
}
0 commit comments