Skip to content

Commit 399b171

Browse files
committed
Remove DocBuilderPathError
1 parent 19cedb1 commit 399b171

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

src/docbuilder/options.rs

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use std::{env, fmt};
44
use std::path::PathBuf;
5+
use errors::*;
56

67

78
#[derive(Clone)]
@@ -23,35 +24,6 @@ pub struct DocBuilderOptions {
2324

2425

2526

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-
5527
impl Default for DocBuilderOptions {
5628
fn default() -> DocBuilderOptions {
5729

@@ -120,18 +92,18 @@ impl DocBuilderOptions {
12092
}
12193

12294

123-
pub fn check_paths(&self) -> Result<(), DocBuilderPathError> {
95+
pub fn check_paths(&self) -> Result<()> {
12496
if !self.destination.exists() {
125-
return Err(DocBuilderPathError::DestinationPathNotExists)
97+
return Err("Destination path not exists".into())
12698
}
12799
if !self.chroot_path.exists() {
128-
return Err(DocBuilderPathError::ChrootPathNotExists)
100+
return Err("Chroot path not exists".into())
129101
}
130102
if !self.crates_io_index_path.exists() {
131-
return Err(DocBuilderPathError::CratesIoIndexPathNotExists)
103+
return Err("crates.io-index path not exists".into())
132104
}
133105
if !self.crates_io_index_path.exists() {
134-
return Err(DocBuilderPathError::LogsPathNotExists)
106+
return Err("Logs path not exists".into())
135107
}
136108
Ok(())
137109
}

0 commit comments

Comments
 (0)