summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-03-27 11:14:38 +0200
committerLars Wirzenius <liw@liw.fi>2021-03-27 11:14:38 +0200
commit939433798b708d986928a124e81dd03c8488ad90 (patch)
treeb6f1fde5f227c4ddef21838fa3d8b6f56be88b43
parent0483cfcc6f85711b7b75fc8f0182e4baf7c0019f (diff)
downloadobnam2-939433798b708d986928a124e81dd03c8488ad90.tar.gz
refactor: drop unnecessary conversions to the same type
-rw-r--r--src/client.rs10
-rw-r--r--src/fsentry.rs2
-rw-r--r--src/generation.rs2
-rw-r--r--src/index.rs4
-rw-r--r--src/server.rs6
5 files changed, 12 insertions, 12 deletions
diff --git a/src/client.rs b/src/client.rs
index 80ae788..d513011 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -245,7 +245,7 @@ impl BackupClient {
debug!("upload_chunk: id={}", chunk_id);
chunk_id.parse().unwrap()
} else {
- return Err(ClientError::NoCreatedChunkId.into());
+ return Err(ClientError::NoCreatedChunkId);
};
info!("uploaded_chunk {} meta {:?}", chunk_id, meta);
Ok(chunk_id)
@@ -264,7 +264,7 @@ impl BackupClient {
debug!("upload_chunk: id={}", chunk_id);
chunk_id.parse().unwrap()
} else {
- return Err(ClientError::NoCreatedChunkId.into());
+ return Err(ClientError::NoCreatedChunkId);
};
info!("uploaded_generation chunk {}", chunk_id);
Ok(chunk_id)
@@ -313,7 +313,7 @@ impl BackupClient {
if res.status() != 200 {
let err = ClientError::ChunkNotFound(chunk_id.to_string());
error!("fetching chunk {} failed: {}", chunk_id, err);
- return Err(err.into());
+ return Err(err);
}
let headers = res.headers();
@@ -321,7 +321,7 @@ impl BackupClient {
if meta.is_none() {
let err = ClientError::NoChunkMeta(chunk_id.clone());
error!("fetching chunk {} failed: {}", chunk_id, err);
- return Err(err.into());
+ return Err(err);
}
let meta = meta.unwrap().to_str()?;
debug!("fetching chunk {}: meta={:?}", chunk_id, meta);
@@ -335,7 +335,7 @@ impl BackupClient {
let err =
ClientError::WrongChecksum(chunk_id.clone(), actual, meta.sha256().to_string());
error!("fetching chunk {} failed: {}", chunk_id, err);
- return Err(err.into());
+ return Err(err);
}
let chunk: DataChunk = DataChunk::new(body);
diff --git a/src/fsentry.rs b/src/fsentry.rs
index 28f7c61..35931ab 100644
--- a/src/fsentry.rs
+++ b/src/fsentry.rs
@@ -196,7 +196,7 @@ impl FilesystemKind {
2 => Ok(FilesystemKind::Symlink),
3 => Ok(FilesystemKind::Socket),
4 => Ok(FilesystemKind::Fifo),
- _ => Err(FsEntryError::UnknownFileKindCode(code).into()),
+ _ => Err(FsEntryError::UnknownFileKindCode(code)),
}
}
}
diff --git a/src/generation.rs b/src/generation.rs
index 174247a..6eabb9b 100644
--- a/src/generation.rs
+++ b/src/generation.rs
@@ -344,7 +344,7 @@ mod sql {
if iter.next() == None {
Ok(Some((fileno, entry, reason)))
} else {
- Err(LocalGenerationError::TooManyFiles(filename.to_path_buf()).into())
+ Err(LocalGenerationError::TooManyFiles(filename.to_path_buf()))
}
}
}
diff --git a/src/index.rs b/src/index.rs
index c8d8d86..6628b50 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -214,12 +214,12 @@ mod sql {
} else {
let err = IndexError::DuplicateChunk(id.clone());
error!("{}", err);
- return Err(err.into());
+ return Err(err);
}
}
if metas.len() == 0 {
eprintln!("lookup: no hits");
- return Err(IndexError::MissingChunk(id.clone()).into());
+ return Err(IndexError::MissingChunk(id.clone()));
}
let r = metas[0].clone();
Ok(r)
diff --git a/src/server.rs b/src/server.rs
index abf3f1e..6ea8ac4 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -49,13 +49,13 @@ impl ServerConfig {
pub fn check(&self) -> Result<(), ServerConfigError> {
if !self.chunks.exists() {
- return Err(ServerConfigError::ChunksDirNotFound(self.chunks.clone()).into());
+ return Err(ServerConfigError::ChunksDirNotFound(self.chunks.clone()));
}
if !self.tls_cert.exists() {
- return Err(ServerConfigError::TlsCertNotFound(self.tls_cert.clone()).into());
+ return Err(ServerConfigError::TlsCertNotFound(self.tls_cert.clone()));
}
if !self.tls_key.exists() {
- return Err(ServerConfigError::TlsKeyNotFound(self.tls_key.clone()).into());
+ return Err(ServerConfigError::TlsKeyNotFound(self.tls_key.clone()));
}
Ok(())
}