mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
commit
dff0293f53
@ -118,7 +118,7 @@ impl<BE: DecryptWriteBackend, I: IndexedBackend> Archiver<BE, I> {
|
||||
while !path.starts_with(&self.path) {
|
||||
// save tree and go back to parent dir
|
||||
let mut chunk = self.tree.serialize()?;
|
||||
chunk.push('\n' as u8); // for whatever reason, restic adds a newline, so to be compatible...
|
||||
chunk.push(b'\n'); // for whatever reason, restic adds a newline, so to be compatible...
|
||||
let id = hash(&chunk);
|
||||
|
||||
let (mut node, tree, parent) = self
|
||||
|
||||
@ -143,7 +143,7 @@ impl ReadSource for LocalSource {
|
||||
impl Iterator for LocalSource {
|
||||
type Item = Result<(PathBuf, Node)>;
|
||||
|
||||
fn next(&mut self) -> std::option::Option<Self::Item> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.walker
|
||||
.next()
|
||||
.map(|e| map_entry(e?, self.with_atime, &self.cache))
|
||||
|
||||
30
src/main.rs
30
src/main.rs
@ -1,3 +1,33 @@
|
||||
// TODO: add
|
||||
// missing_docs,
|
||||
// unused_results,
|
||||
// trivial_casts??
|
||||
#![warn(
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
missing_copy_implementations,
|
||||
missing_debug_implementations,
|
||||
non_shorthand_field_patterns,
|
||||
no_mangle_generic_items,
|
||||
overflowing_literals,
|
||||
path_statements,
|
||||
patterns_in_fns_without_body,
|
||||
private_in_public,
|
||||
trivial_numeric_casts,
|
||||
unsafe_code,
|
||||
unused_extern_crates,
|
||||
unused_import_braces,
|
||||
unused_qualifications,
|
||||
unconditional_recursion,
|
||||
unused,
|
||||
unused_allocation,
|
||||
unused_comparisons,
|
||||
unused_parens,
|
||||
while_true
|
||||
)]
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
mod archiver;
|
||||
|
||||
@ -57,10 +57,7 @@ pub enum DeleteOption {
|
||||
|
||||
impl DeleteOption {
|
||||
fn is_not_set(&self) -> bool {
|
||||
match self {
|
||||
Self::NotSet => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Self::NotSet)
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,10 +277,7 @@ impl SnapshotFile {
|
||||
|
||||
/// Returns whether a snapshot must be deleted now
|
||||
pub fn must_delete(&self, now: DateTime<Local>) -> bool {
|
||||
match self.delete {
|
||||
DeleteOption::After(time) if time < now => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self.delete,DeleteOption::After(time) if time < now)
|
||||
}
|
||||
|
||||
/// Returns whether a snapshot must be kept now
|
||||
@ -304,12 +298,12 @@ impl PartialEq<SnapshotFile> for SnapshotFile {
|
||||
impl Eq for SnapshotFile {}
|
||||
|
||||
impl PartialOrd for SnapshotFile {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
self.time.partial_cmp(&other.time)
|
||||
}
|
||||
}
|
||||
impl Ord for SnapshotFile {
|
||||
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.time.cmp(&other.time)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user