Skip to content

Commit acfcec2

Browse files
Remove derive_more
1 parent 64cddbe commit acfcec2

File tree

7 files changed

+19
-48
lines changed

7 files changed

+19
-48
lines changed

Cargo.lock

Lines changed: 0 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ edition = "2018"
1212

1313
[dependencies]
1414
chrono = { version = "0.4.6", features = [ "serde" ] }
15-
derive_more = "0.14.0"
1615
thiserror = "1"
1716
log = "0.4.5"
1817
reqwest = { version = "0.10.0", features = ["blocking"] }

library/src/cache.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ impl FsCache {
1919
pub fn new(path: impl AsRef<Path>) -> Result<Self, Error> {
2020
let path = path.as_ref();
2121
if !path.exists() {
22-
fs::create_dir_all(path).map_err(|e| (e, format!("creating path {:?}", path)))?;
22+
fs::create_dir_all(path)
23+
.map_err(|e| Error::Io(e, format!("creating path {:?}", path)))?;
2324
}
2425
Ok(FsCache {
2526
storage_path: Some(path.into()),

library/src/downloader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ where
113113
let mut bytes = Vec::new();
114114
io::copy(&mut response, &mut bytes).map_err(|e| Error::Io(e, url.into()))?;
115115

116-
toml::from_slice(&bytes).map_err(|e| (e, url.to_string()).into())
116+
toml::from_slice(&bytes).map_err(|e| Error::TomlDe(e, url.to_string()))
117117
}
118118
}

library/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub use source::{DefaultSource, SourceInfo};
2828
use std::io;
2929

3030
/// An error that might happen inside the library.
31-
#[derive(Debug, derive_more::From, thiserror::Error)]
31+
#[derive(Debug, thiserror::Error)]
3232
pub enum Error {
3333
/// TOML parsing error.
3434
#[error("TOML deserialization error {0} on manifest {1}")]

library/src/manifest.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,21 @@ impl Manifest {
5353
/// Tries to load a `Manifest` from the file system.
5454
pub fn load_from_fs(path: impl AsRef<Path>) -> Result<Self, Error> {
5555
let path = path.as_ref();
56-
let mut f = File::open(path).map_err(|e| (e, format!("opening {:?}", path)))?;
56+
let mut f = File::open(path).map_err(|e| Error::Io(e, format!("opening {:?}", path)))?;
5757
let mut data = String::new();
5858
f.read_to_string(&mut data)
59-
.map_err(|e| (e, format!("reading {:?}", path)))?;
60-
toml::from_str(&data).map_err(|e| (e, format!("{:?}", path)).into())
59+
.map_err(|e| Error::Io(e, format!("reading {:?}", path)))?;
60+
toml::from_str(&data).map_err(|e| Error::TomlDe(e, format!("{:?}", path)))
6161
}
6262

6363
/// Serializes the `Manifest` to a given path.
6464
pub fn save_to_file(&self, path: impl AsRef<Path>) -> Result<(), Error> {
6565
let path = path.as_ref();
66-
let mut f = File::create(path).map_err(|e| (e, format!("creating {:?}", path)))?;
67-
let data = toml::to_vec(self).map_err(|e| (e, format!("serializing {}", self.date)))?;
66+
let mut f = File::create(path).map_err(|e| Error::Io(e, format!("creating {:?}", path)))?;
67+
let data = toml::to_vec(self)
68+
.map_err(|e| Error::TomlSer(e, format!("serializing {}", self.date)))?;
6869
f.write_all(&data)
69-
.map_err(|e| (e, format!("writing to {:?}", path)))?;
70+
.map_err(|e| Error::Io(e, format!("writing to {:?}", path)))?;
7071
Ok(())
7172
}
7273
}

library/src/types.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
//! Types that are used internally.
22
3+
use std::fmt;
34
use std::{borrow::Borrow, ops::Deref, rc::Rc};
45

56
/// Reference-counted build-target triple.
6-
#[derive(Debug, Clone, Hash, PartialEq, derive_more::Display, Eq)]
7+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
78
pub struct TargetTripple(Rc<str>);
89

10+
impl fmt::Display for TargetTripple {
11+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12+
write!(f, "{}", self.0)
13+
}
14+
}
15+
916
impl Deref for TargetTripple {
1017
type Target = str;
1118

0 commit comments

Comments
 (0)