Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/backend/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::doc_markdown)]
use std::{num::TryFromIntError, process::ExitStatus, str::Utf8Error};

use displaydoc::Display;
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct Archiver<'a, BE: DecryptFullBackend, I: ReadGlobalIndex> {
/// The parent snapshot to use.
parent: Parent,

/// The SharedIndexer is used to index the data.
/// The `SharedIndexer` is used to index the data.
indexer: SharedIndexer<BE>,

/// The backend to write to.
Expand All @@ -49,7 +49,7 @@ pub struct Archiver<'a, BE: DecryptFullBackend, I: ReadGlobalIndex> {
/// The backend to write to.
index: &'a I,

/// The SnapshotFile to write to.
/// The `SnapshotFile` to write to.
snap: SnapshotFile,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/archiver/parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl Parent {
let parent = match parent {
ParentResult::Matched(p_node) => {
if p_node.content.iter().flatten().all(|id| index.has_data(id)) {
node.content = p_node.content.clone();
node.content.clone_from(&p_node.content);
ParentResult::Matched(())
} else {
warn!(
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/backend/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl Iterator for LocalSourceWalker {
self.save_opts.with_atime,
self.save_opts.ignore_devid,
)
.map_err(std::convert::Into::into)
.map_err(Into::into)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/backend/local_destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl LocalDestination {

if let Some(mode) = node.meta.mode {
let mode = map_mode_from_go(mode);
std::fs::set_permissions(filename, fs::Permissions::from_mode(mode))
fs::set_permissions(filename, fs::Permissions::from_mode(mode))
.map_err(LocalDestinationErrorKind::SettingFilePermissionsFailed)?;
}
Ok(())
Expand Down Expand Up @@ -660,7 +660,7 @@ impl LocalDestination {
/// [`LocalDestinationErrorKind::CouldNotWriteToBuffer`]: crate::error::LocalDestinationErrorKind::CouldNotWriteToBuffer
pub fn write_at(&self, item: impl AsRef<Path>, offset: u64, data: &[u8]) -> RusticResult<()> {
let filename = self.path(item);
let mut file = fs::OpenOptions::new()
let mut file = OpenOptions::new()
.create(true)
.truncate(false)
.write(true)
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/blob/packer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl PackSizer {
#[allow(clippy::struct_field_names)]
#[derive(Clone)]
pub struct Packer<BE: DecryptWriteBackend> {
/// The raw packer wrapped in an Arc and RwLock.
/// The raw packer wrapped in an `Arc` and `RwLock`.
// This is a hack: raw_packer and indexer are only used in the add_raw() method.
// TODO: Refactor as actor, like the other add() methods
raw_packer: Arc<RwLock<RawPacker<BE>>>,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/blob/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ pub(crate) fn merge_trees(

let mut tree_iters: Vec<_> = trees
.iter()
.map(|id| Tree::from_backend(be, index, *id).map(std::iter::IntoIterator::into_iter))
.map(|id| Tree::from_backend(be, index, *id).map(IntoIterator::into_iter))
.collect::<RusticResult<_>>()?;

// fill Heap with first elements from all trees
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct ConfigOptions {
pub set_treepack_size: Option<ByteSize>,

/// Set upper limit for default packsize for tree packs.
/// Note that packs actually can get up to some MiBs larger.
/// Note that packs actually can get a bit larger.
/// If not set, pack sizes can grow up to approximately `4 GiB`.
#[cfg_attr(feature = "clap", clap(long, value_name = "SIZE"))]
pub set_treepack_size_limit: Option<ByteSize>,
Expand All @@ -151,7 +151,7 @@ pub struct ConfigOptions {
pub set_datapack_growfactor: Option<u32>,

/// Set upper limit for default packsize for tree packs.
/// Note that packs actually can get up to some MiBs larger.
/// Note that packs actually can get a bit larger.
/// If not set, pack sizes can grow up to approximately `4 GiB`.
#[cfg_attr(feature = "clap", clap(long, value_name = "SIZE"))]
pub set_datapack_size_limit: Option<ByteSize>,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ impl BlobLocation {
self.uncompressed_length
.map_or(
self.length - 32, // crypto overhead
std::num::NonZeroU32::get,
NonZeroU32::get,
)
.into()
}
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Error types and Result module.

// FIXME: Remove when 'displaydoc' has fixed/recommended further treatment upstream: https://github.com/yaahc/displaydoc/issues/48
#![allow(clippy::doc_markdown)]
// use std::error::Error as StdError;
// use std::fmt;

Expand Down
6 changes: 2 additions & 4 deletions crates/core/src/repofile/snapshotfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl SnapshotFile {
.collect::<Vec<_>>()
.join(" ")
},
std::clone::Clone::clone,
Clone::clone,
);

let mut snap = Self {
Expand Down Expand Up @@ -951,9 +951,7 @@ pub struct StringList(pub(crate) Vec<String>);
impl FromStr for StringList {
type Err = RusticError;
fn from_str(s: &str) -> RusticResult<Self> {
Ok(Self(
s.split(',').map(std::string::ToString::to_string).collect(),
))
Ok(Self(s.split(',').map(ToString::to_string).collect()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pub struct Repository<P, S> {
/// The name of the repository
pub name: String,

/// The HotColdBackend to use for this repository
/// The `HotColdBackend` to use for this repository
pub(crate) be: Arc<dyn WriteBackend>,

/// The Backend to use for hot files
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl VfsTree {
return Ok(VfsPath::RusticPath(id, path));
}
Self::VirtualTree(virtual_tree) => match components.next() {
Some(std::path::Component::Normal(name)) => {
Some(Component::Normal(name)) => {
if let Some(new_tree) = virtual_tree.get(name) {
tree = new_tree;
} else {
Expand Down
20 changes: 11 additions & 9 deletions crates/core/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@
use anyhow::Result;
use flate2::read::GzDecoder;
use globset::Glob;
use insta::internals::{Content, ContentPath};
use insta::{assert_ron_snapshot, Settings};
use insta::{
assert_ron_snapshot,
internals::{Content, ContentPath},
Settings,
};
use pretty_assertions::assert_eq;
use rstest::fixture;
use rstest::rstest;
use rstest::{fixture, rstest};
use rustic_core::repofile::{Metadata, Node};
use rustic_core::{
repofile::SnapshotFile, BackupOptions, ConfigOptions, KeyOptions, LsOptions, NoProgressBars,
OpenStatus, PathList, Repository, RepositoryBackends, RepositoryOptions,
repofile::SnapshotFile, BackupOptions, ConfigOptions, FindMatches, FindNode, KeyOptions,
LsOptions, NoProgressBars, OpenStatus, PathList, Repository, RepositoryBackends,
RepositoryOptions, RusticResult,
};
use rustic_core::{FindMatches, FindNode, RusticResult};
use serde::Serialize;

use rustic_testing::backend::in_memory_backend::InMemoryBackend;
Expand Down Expand Up @@ -93,7 +95,7 @@ fn handle_option(val: Content, _: ContentPath<'_>) -> String {

#[fixture]
fn insta_summary_redaction() -> Settings {
let mut settings = insta::Settings::clone_current();
let mut settings = Settings::clone_current();

settings.add_redaction(".tree", "[tree_id]");
settings.add_dynamic_redaction(".program_version", |val, _| {
Expand Down Expand Up @@ -128,7 +130,7 @@ fn insta_summary_redaction() -> Settings {

#[fixture]
fn insta_tree_redaction() -> Settings {
let mut settings = insta::Settings::clone_current();
let mut settings = Settings::clone_current();

settings.add_redaction(".nodes[].inode", "[inode]");
settings.add_redaction(".nodes[].device_id", "[device_id]");
Expand Down