remove warnings

This commit is contained in:
Cyryl Płotnicki 2019-09-01 21:23:15 +01:00
parent 36cff8cb06
commit 0c715852d6
5 changed files with 3 additions and 29 deletions

View file

@ -3,7 +3,6 @@ pub mod error;
pub mod restore; pub mod restore;
pub mod source; pub mod source;
use serde::{Deserialize, Serialize};
mod index; mod index;
pub mod repository; pub mod repository;
mod repository_item; mod repository_item;

View file

@ -1,12 +1,9 @@
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use walkdir::WalkDir;
use crate::error::BakareError; use crate::error::BakareError;
use crate::index::{Index, IndexIterator}; use crate::index::{Index, IndexIterator};
use crate::repository_item::RepositoryItem; use crate::repository_item::RepositoryItem;
use serde::{Deserialize, Serialize};
use std::fs::File; use std::fs::File;
/// represents a place where backup is stored an can be restored from. /// represents a place where backup is stored an can be restored from.
@ -95,22 +92,4 @@ impl<'a> Repository<'a> {
} }
Ok(self.iter().find(|i| i.original_source_path() == path)) Ok(self.iter().find(|i| i.original_source_path() == path))
} }
fn get_all_files_recursively(path: &Path) -> Result<Vec<Box<Path>>, BakareError> {
let walker = WalkDir::new(path);
let mut result = vec![];
for maybe_entry in walker {
let entry = maybe_entry?;
if entry.path() == path {
continue;
}
if entry.path().is_file() {
result.push(Box::from(entry.path()));
}
}
Ok(result)
}
} }

View file

@ -1,5 +1,4 @@
use crate::error::BakareError; use crate::error::BakareError;
use serde::{Deserialize, Serialize};
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;

View file

@ -1,8 +1,5 @@
use std::fs;
use std::path::Path; use std::path::Path;
use walkdir::DirEntry;
use crate::error::BakareError; use crate::error::BakareError;
use crate::repository::Repository; use crate::repository::Repository;
use crate::repository_item::RepositoryItem; use crate::repository_item::RepositoryItem;

View file

@ -26,13 +26,13 @@ fn restore_backed_up_files() -> Result<(), BakareError> {
fn restore_older_version_of_file() -> Result<(), BakareError> { fn restore_older_version_of_file() -> Result<(), BakareError> {
let source = TempSource::new()?; let source = TempSource::new()?;
let repository_path = tempdir()?.into_path(); let repository_path = tempdir()?.into_path();
let restore_repository = Repository::open(repository_path.as_path())?; //let restore_repository = Repository::open(repository_path.as_path())?;
let relative_path_text = "some path"; let relative_path_text = "some path";
let file_path = source.file_path(relative_path_text); let file_path = source.file_path(relative_path_text);
let new_contents = "totally new contents"; let new_contents = "totally new contents";
let restore_target = tempdir()?; let restore_target = tempdir()?;
let restore_engine = restore::Engine::new(&restore_repository, &restore_target.path())?; //let restore_engine = restore::Engine::new(&restore_repository, &restore_target.path())?;
let old_contents = "some old contents"; let old_contents = "some old contents";
{ {
@ -45,7 +45,7 @@ fn restore_older_version_of_file() -> Result<(), BakareError> {
let reading_repository = Repository::open(repository_path.as_path())?; let reading_repository = Repository::open(repository_path.as_path())?;
let file_id = reading_repository.item_by_source_path(&file_path)?; let file_id = reading_repository.item_by_source_path(&file_path)?;
assert!(file_id.is_some()); assert!(file_id.is_some());
let file_id = file_id.unwrap(); //let file_id = file_id.unwrap();
//let old_version = file_id.version(); //let old_version = file_id.version();
{ {