Skip to content

Commit

Permalink
style: cargo fmt & dprint fmt
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Sep 14, 2023
1 parent b1db44a commit 93330f0
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions crates/rustic_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ codegen-units = 4

[profile.release]
opt-level = 3
debug = false # true for profiling
debug = false # true for profiling
rpath = false
lto = "fat"
debug-assertions = false
Expand All @@ -165,7 +165,7 @@ codegen-units = 4

[profile.bench]
opt-level = 3
debug = true # true for profiling
debug = true # true for profiling
rpath = false
lto = true
debug-assertions = false
Expand Down
4 changes: 2 additions & 2 deletions crates/rustic_core/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<BE: DecryptWriteBackend, I: IndexedBackend> Archiver<BE, I> {
///
/// * [`PackerErrorKind::SendingCrossbeamMessageFailed`] - If sending the message to the raw packer fails.
/// * [`PackerErrorKind::IntConversionFailed`] - If converting the data length to u64 fails
///
///
/// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed
/// [`PackerErrorKind::IntConversionFailed`]: crate::error::PackerErrorKind::IntConversionFailed
pub fn new(
Expand Down Expand Up @@ -111,7 +111,7 @@ impl<BE: DecryptWriteBackend, I: IndexedBackend> Archiver<BE, I> {
/// * [`PackerErrorKind::SendingCrossbeamMessageFailed`] - If sending the message to the raw packer fails.
/// * [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`] - If the index file could not be serialized.
/// * [`SnapshotFileErrorKind::OutOfRange`] - If the time is not in the range of `Local::now()`
///
///
/// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed
/// [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`]: crate::error::CryptBackendErrorKind::SerializingToJsonByteVectorFailed
/// [`SnapshotFileErrorKind::OutOfRange`]: crate::error::SnapshotFileErrorKind::OutOfRange
Expand Down
6 changes: 3 additions & 3 deletions crates/rustic_core/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub trait ReadBackend: Clone + Send + Sync + 'static {
///
/// This function is used to find the id of a snapshot or index file.
/// The id of a snapshot or index file is the id of the first pack file.
///
///
/// [`BackendErrorKind::NoSuitableIdFound`]: crate::error::BackendErrorKind::NoSuitableIdFound
/// [`BackendErrorKind::IdNotUnique`]: crate::error::BackendErrorKind::IdNotUnique
fn find_starts_with<T: AsRef<str>>(&self, tpe: FileType, vec: &[T]) -> RusticResult<Vec<Id>> {
Expand Down Expand Up @@ -218,7 +218,7 @@ pub trait ReadBackend: Clone + Send + Sync + 'static {
/// * [`IdErrorKind::HexError`] - If the string is not a valid hexadecimal string
/// * [`BackendErrorKind::NoSuitableIdFound`] - If no id could be found.
/// * [`BackendErrorKind::IdNotUnique`] - If the id is not unique.
///
///
/// [`IdErrorKind::HexError`]: crate::error::IdErrorKind::HexError
/// [`BackendErrorKind::NoSuitableIdFound`]: crate::error::BackendErrorKind::NoSuitableIdFound
/// [`BackendErrorKind::IdNotUnique`]: crate::error::BackendErrorKind::IdNotUnique
Expand All @@ -242,7 +242,7 @@ pub trait ReadBackend: Clone + Send + Sync + 'static {
/// * [`IdErrorKind::HexError`] - If the string is not a valid hexadecimal string
/// * [`BackendErrorKind::NoSuitableIdFound`] - If no id could be found.
/// * [`BackendErrorKind::IdNotUnique`] - If the id is not unique.
///
///
/// [`IdErrorKind::HexError`]: crate::error::IdErrorKind::HexError
/// [`BackendErrorKind::NoSuitableIdFound`]: crate::error::BackendErrorKind::NoSuitableIdFound
/// [`BackendErrorKind::IdNotUnique`]: crate::error::BackendErrorKind::IdNotUnique
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/backend/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ fn get_group_by_gid(gid: u32) -> Option<String> {
///
/// * [`IgnoreErrorKind::GenericError`] - If metadata could not be read.
/// * [`IgnoreErrorKind::FromIoError`] - If the xattr of the entry could not be read.
///
///
/// [`IgnoreErrorKind::GenericError`]: crate::error::IgnoreErrorKind::GenericError
/// [`IgnoreErrorKind::FromIoError`]: crate::error::IgnoreErrorKind::FromIoError
#[cfg(not(windows))]
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/backend/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl LocalBackend {
/// # Errors
///
/// * [`LocalErrorKind::DirectoryCreationFailed`] - If the directory could not be created.
///
///
/// [`LocalErrorKind::DirectoryCreationFailed`]: crate::error::LocalErrorKind::DirectoryCreationFailed
// TODO: We should use `impl Into<Path/PathBuf>` here. we even use it in the body!
pub fn new(path: &str) -> RusticResult<Self> {
Expand Down
4 changes: 2 additions & 2 deletions crates/rustic_core/src/backend/rclone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct RcloneBackend {
/// # Returns
///
/// The rclone version as a tuple of (major, minor, patch).
///
///
/// [`ProviderErrorKind::FromIoError`]: crate::error::ProviderErrorKind::FromIoError
/// [`ProviderErrorKind::FromUtf8Error`]: crate::error::ProviderErrorKind::FromUtf8Error
/// [`ProviderErrorKind::NoOutputForRcloneVersion`]: crate::error::ProviderErrorKind::NoOutputForRcloneVersion
Expand Down Expand Up @@ -104,7 +104,7 @@ impl RcloneBackend {
/// * [`ProviderErrorKind::UrlNotStartingWithHttp`] - If the URL does not start with `http`.
/// * [`RestErrorKind::UrlParsingFailed`] - If the URL could not be parsed.
/// * [`RestErrorKind::BuildingClientFailed`] - If the client could not be built.
///
///
/// [`ProviderErrorKind::FromIoError`]: crate::error::ProviderErrorKind::FromIoError
/// [`ProviderErrorKind::NoStdOutForRclone`]: crate::error::ProviderErrorKind::NoStdOutForRclone
/// [`ProviderErrorKind::RCloneExitWithBadStatus`]: crate::error::ProviderErrorKind::RCloneExitWithBadStatus
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl ConfigOptions {
/// * [`CommandErrorKind::SizeTooLarge`] - If the size is too large
/// * [`CommandErrorKind::MinPackSizeTolerateWrong`] - If the min packsize tolerate percent is wrong
/// * [`CommandErrorKind::MaxPackSizeTolerateWrong`] - If the max packsize tolerate percent is wrong
///
///
/// [`CommandErrorKind::VersionNotSupported`]: crate::error::CommandErrorKind::VersionNotSupported
/// [`CommandErrorKind::CannotDowngrade`]: crate::error::CommandErrorKind::CannotDowngrade
/// [`CommandErrorKind::NoCompressionV1Repo`]: crate::error::CommandErrorKind::NoCompressionV1Repo
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
/// # Returns
///
/// A tuple of the key and the config file.
///
///
/// [`PolynomialErrorKind::NoSuitablePolynomialFound`]: crate::error::PolynomialErrorKind::NoSuitablePolynomialFound
pub(crate) fn init<P, S>(
repo: &Repository<P, S>,
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Id {
///
/// assert_eq!(id.to_hex().as_str(), "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef");
/// ```
///
///
/// [`IdErrorKind::HexError`]: crate::error::IdErrorKind::HexError
pub fn from_hex(s: &str) -> RusticResult<Self> {
let mut id = Self::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/rustic_core/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl<BE: DecryptReadBackend> IndexedBackend for IndexBackend<BE> {
/// # Errors
///
/// * [`IndexErrorKind::BlobInIndexNotFound`] - If the blob could not be found in the index
///
///
/// [`IndexErrorKind::BlobInIndexNotFound`]: crate::error::IndexErrorKind::BlobInIndexNotFound
fn blob_from_backend(&self, tpe: BlobType, id: &Id) -> RusticResult<Bytes> {
self.get_id(tpe, id).map_or_else(
Expand Down
11 changes: 4 additions & 7 deletions xtask/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
/// Remove a set of files given a glob
///
/// # Errors
///
///
/// Fails if listing or removal fails
///
pub fn clean_files(pattern: &str) -> AnyResult<()> {
Expand All @@ -21,7 +21,7 @@ pub fn clean_files(pattern: &str) -> AnyResult<()> {
/// Remove a single file
///
/// # Errors
///
///
/// Fails if removal fails
///
pub fn remove_file<P>(path: P) -> AnyResult<()>
Expand All @@ -35,7 +35,7 @@ where
/// Remove a directory with its contents
///
/// # Errors
///
///
/// Fails if removal fails
///
pub fn remove_dir<P>(path: P) -> AnyResult<()>
Expand All @@ -45,7 +45,6 @@ where
fsx::dir::remove(path).map_err(anyhow::Error::msg)
}


/// Check if path exists
///
pub fn exists<P>(path: P) -> bool
Expand All @@ -55,11 +54,10 @@ where
std::path::Path::exists(path.as_ref())
}


/// Copy entire folder contents
///
/// # Errors
///
///
/// Fails if file operations fail
///
pub fn copy_contents<P, Q>(from: P, to: Q, overwrite: bool) -> AnyResult<u64>
Expand All @@ -73,7 +71,6 @@ where
fsx::dir::copy(from, to, &opts).map_err(anyhow::Error::msg)
}


/// Prompt the user to confirm an action
///
/// # Panics
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/tasks/bloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use duct::cmd;
/// Show longest times taken in release build
///
/// # Errors
///
///
/// Errors if the command failed
///
pub fn bloat_time(package: impl Into<Option<String>>) -> Result<()> {
Expand All @@ -17,7 +17,7 @@ pub fn bloat_time(package: impl Into<Option<String>>) -> Result<()> {
/// Show biggest crates in release build
///
/// # Errors
///
///
/// Errors if the command failed
///
pub fn bloat_deps(package: impl Into<Option<String>>) -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/tasks/install_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum InstallationKind {
/// Install cargo tools
///
/// # Errors
///
///
/// Errors if one of the commands failed
///
pub fn install_deps(kind: InstallationKind) -> Result<()> {
Expand Down

0 comments on commit 93330f0

Please sign in to comment.