make clippy happy for test code paths
This commit is contained in:
parent
e36307cee5
commit
dafa3db49d
1 changed files with 10 additions and 8 deletions
18
src/main.rs
18
src/main.rs
|
@ -1,6 +1,7 @@
|
||||||
extern crate core;
|
extern crate core;
|
||||||
extern crate crypto;
|
#[cfg(test)]
|
||||||
extern crate dir_diff;
|
extern crate dir_diff;
|
||||||
|
#[cfg(test)]
|
||||||
extern crate tempfile;
|
extern crate tempfile;
|
||||||
extern crate walkdir;
|
extern crate walkdir;
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ impl<'a> BackupEngine<'a> {
|
||||||
match maybe_entry {
|
match maybe_entry {
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
if entry.path() != self.source_path {
|
if entry.path() != self.source_path {
|
||||||
self.process_entry(entry)?;
|
self.process_entry(&entry)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => return Err(error.into()),
|
Err(error) => return Err(error.into()),
|
||||||
|
@ -38,7 +39,7 @@ impl<'a> BackupEngine<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_entry(&self, entry: DirEntry) -> Result<(), io::Error> {
|
fn process_entry(&self, entry: &DirEntry) -> Result<(), io::Error> {
|
||||||
if entry.file_type().is_dir() {
|
if entry.file_type().is_dir() {
|
||||||
fs::create_dir(self.repository_path.join(entry.file_name()))?;
|
fs::create_dir(self.repository_path.join(entry.file_name()))?;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ impl<'a> RestoreEngine<'a> {
|
||||||
match maybe_entry {
|
match maybe_entry {
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
if entry.path() != self.repository_path {
|
if entry.path() != self.repository_path {
|
||||||
self.process_entry(entry)?;
|
self.process_entry(&entry)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => return Err(error.into()),
|
Err(error) => return Err(error.into()),
|
||||||
|
@ -77,7 +78,7 @@ impl<'a> RestoreEngine<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_entry(&self, entry: DirEntry) -> Result<(), io::Error> {
|
fn process_entry(&self, entry: &DirEntry) -> Result<(), io::Error> {
|
||||||
if entry.file_type().is_dir() {
|
if entry.file_type().is_dir() {
|
||||||
fs::create_dir(self.target_path.join(entry.file_name()))?;
|
fs::create_dir(self.target_path.join(entry.file_name()))?;
|
||||||
}
|
}
|
||||||
|
@ -88,19 +89,20 @@ impl<'a> RestoreEngine<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod rustback {
|
fn main() {}
|
||||||
|
|
||||||
use super::*;
|
mod rustback {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod should {
|
mod should {
|
||||||
|
|
||||||
use super::*;
|
|
||||||
use dir_diff::is_different;
|
use dir_diff::is_different;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
use BackupEngine;
|
||||||
|
use RestoreEngine;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn be_able_to_restore_backed_up_files() -> Result<(), Error> {
|
fn be_able_to_restore_backed_up_files() -> Result<(), Error> {
|
||||||
|
|
Loading…
Reference in a new issue