Skip to content

Commit 943acf2

Browse files
committed
chore: update to 2024 edition and fix clippy lints
1 parent 13587a2 commit 943acf2

23 files changed

+45
-43
lines changed

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ members = [
66
"crates/testing",
77
"examples/*",
88
]
9-
resolver = "2"
9+
resolver = "3"
1010

1111
[workspace.package]
12-
rust-version = "1.76.0"
12+
rust-version = "1.85.0"
1313

1414
[workspace.dependencies]
1515
# Internal Dependencies
@@ -106,6 +106,7 @@ pedantic = { level = "warn", priority = -1 }
106106
nursery = { level = "warn", priority = -1 }
107107
# expect_used = "warn" # TODO!
108108
# unwrap_used = "warn" # TODO!
109+
literal_string_with_formatting_args = "allow"
109110
enum_glob_use = "warn"
110111
correctness = { level = "warn", priority = -1 }
111112
suspicious = { level = "warn", priority = -1 }

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Please make sure, that you read the
214214

215215
## Minimum Rust version policy
216216

217-
This crate's minimum supported `rustc` version is `1.76.0`.
217+
This crate's minimum supported `rustc` version is `1.85.0`.
218218

219219
The current policy is that the minimum Rust version required to use this crate
220220
can be increased in minor version updates. For example, if `crate 1.0` requires

crates/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "Apache-2.0 OR MIT"
1212
publish = true
1313
readme = "README.md"
1414
repository = "https://github.com/rustic-rs/rustic_core/tree/main/crates/backend"
15-
resolver = "2"
15+
resolver = "3"
1616
rust-version = { workspace = true }
1717
description = """
1818
rustic_backend - library for supporting various backends in rustic-rs

crates/backend/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Please make sure, that you read the
101101

102102
## Minimum Rust version policy
103103

104-
This crate's minimum supported `rustc` version is `1.76.0`.
104+
This crate's minimum supported `rustc` version is `1.85.0`.
105105

106106
The current policy is that the minimum Rust version required to use this crate
107107
can be increased in minor version updates. For example, if `crate 1.0` requires

crates/config/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ version = "0.2.2"
44
authors = ["the rustic-rs team"]
55
categories = ["config"]
66
documentation = "https://docs.rs/rustic_config"
7-
edition = "2021"
7+
edition = "2024"
88
homepage = "https://rustic.cli.rs/"
99
include = ["src/**/*", "LICENSE-*", "README.md"]
1010
keywords = ["backup", "restic", "deduplication", "encryption", "library"]
1111
license = "Apache-2.0 OR MIT"
1212
publish = true
1313
readme = "README.md"
1414
repository = "https://github.com/rustic-rs/rustic_core"
15-
resolver = "2"
15+
resolver = "3"
1616
rust-version = { workspace = true }
1717
description = """
1818
rustic_config - library for configuration support in rustic-rs

crates/config/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Please make sure, that you read the
7979

8080
## Minimum Rust version policy
8181

82-
This crate's minimum supported `rustc` version is `1.76.0`.
82+
This crate's minimum supported `rustc` version is `1.85.0`.
8383

8484
The current policy is that the minimum Rust version required to use this crate
8585
can be increased in minor version updates. For example, if `crate 1.0` requires

crates/core/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ version = "0.7.3"
44
authors = ["the rustic-rs team"]
55
categories = ["data-structures", "encoding", "filesystem"]
66
documentation = "https://docs.rs/rustic_core"
7-
edition = "2021"
7+
edition = "2024"
88
homepage = "https://rustic.cli.rs/"
99
include = ["src/**/*", "LICENSE-*", "README.md"]
1010
keywords = ["backup", "restic", "deduplication", "encryption", "library"]
1111
license = "Apache-2.0 OR MIT"
1212
publish = true
1313
readme = "README.md"
1414
repository = "https://github.com/rustic-rs/rustic_core"
15-
resolver = "2"
15+
resolver = "3"
1616
rust-version = { workspace = true }
1717
description = """
1818
rustic_core - library for fast, encrypted, deduplicated backups that powers rustic-rs

crates/core/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Please make sure, that you read the
216216

217217
## Minimum Rust version policy
218218

219-
This crate's minimum supported `rustc` version is `1.76.0`.
219+
This crate's minimum supported `rustc` version is `1.85.0`.
220220

221221
The current policy is that the minimum Rust version required to use this crate
222222
can be increased in minor version updates. For example, if `crate 1.0` requires

crates/core/src/backend/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl ReadBackend for CachedBackend {
151151
"Error in cache backend reading {tpe:?},{id}: {}",
152152
err.display_log()
153153
),
154-
};
154+
}
155155
// read full file, save to cache and return partial content
156156
match self.be.read_full(tpe, id) {
157157
Ok(data) => {

crates/core/src/backend/ignore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ pub mod mapper {
754754
// note that POSIX specifies regular files, whereas golang specifies irregular files
755755
S_IFREG => {}
756756
_ => go_mode |= GO_MODE_IRREG,
757-
};
757+
}
758758

759759
if mode & S_ISUID > 0 {
760760
go_mode |= GO_MODE_SETUID;

crates/core/src/backend/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn escape_filename(name: &OsStr) -> String {
424424
'\t' => s.push_str("\\t"),
425425
'\u{b}' => s.push_str("\\v"),
426426
c => s.push(c),
427-
};
427+
}
428428
}
429429
};
430430

crates/core/src/blob/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ pub(crate) fn merge_trees(
10271027
// use this node as new node
10281028
(node, num) = (new_node, new_num);
10291029
}
1030-
};
1030+
}
10311031
}
10321032
let (id, size) = save(tree)?;
10331033
if trees.contains(&id) {

crates/core/src/commands/backup.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub(crate) fn backup<P: ProgressBars, S: IndexedIds>(
262262
.join(","),
263263
)
264264
})?,
265-
};
265+
}
266266

267267
let (parent_id, parent) = opts.parent_opts.get_parent(repo, &snap, backup_stdin);
268268
match parent_id {
@@ -273,7 +273,7 @@ pub(crate) fn backup<P: ProgressBars, S: IndexedIds>(
273273
None => {
274274
info!("using no parent");
275275
}
276-
};
276+
}
277277

278278
let be = DryRunBackend::new(repo.dbe().clone(), opts.dry_run);
279279
info!("starting to backup {source} ...");

crates/core/src/commands/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ mod tests {
817817
assert!(test_size <= size && size <= test_size + u64::from(PACK_SIZE));
818818
}
819819
ReadSubsetOption::IdSubSet(_) => {}
820-
};
820+
}
821821

822822
let ids: Vec<_> = packs.iter().map(|pack| (pack.id, pack.size)).collect();
823823
assert_ron_snapshot!(s, ids);

crates/core/src/commands/repair/snapshots.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub(crate) fn repair_tree<BE: DecryptWriteBackend>(
224224

225225
for mut node in tree {
226226
match node.node_type {
227-
NodeType::File {} => {
227+
NodeType::File => {
228228
let mut file_changed = false;
229229
let mut new_content = Vec::new();
230230
let mut new_size = 0;
@@ -250,7 +250,7 @@ pub(crate) fn repair_tree<BE: DecryptWriteBackend>(
250250
node.content = Some(new_content);
251251
node.meta.size = new_size;
252252
}
253-
NodeType::Dir {} => {
253+
NodeType::Dir => {
254254
let (c, tree_id) =
255255
repair_tree(be, opts, index, packer, node.subtree, state, dry_run)?;
256256
match c {

crates/core/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl RusticError {
395395
});
396396

397397
_ = write!(fmt, "{guidance}");
398-
};
398+
}
399399

400400
_ = write!(fmt, " (kind: related to {}", self.kind);
401401

crates/core/src/index/binarysorted.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl IndexCollector {
127127
EntriesVariants::None => {}
128128
EntriesVariants::Ids(ids) => ids.par_sort_unstable(),
129129
EntriesVariants::FullEntries(entries) => entries.par_sort_unstable_by_key(|e| e.id),
130-
};
130+
}
131131

132132
let packs = tc.packs.into_iter().map(|(id, _)| id).collect();
133133
TypeIndex {
@@ -158,7 +158,7 @@ impl Extend<IndexPack> for IndexCollector {
158158
EntriesVariants::None => {}
159159
EntriesVariants::Ids(idents) => idents.reserve(len),
160160
EntriesVariants::FullEntries(entries) => entries.reserve(len),
161-
};
161+
}
162162

163163
for blob in &p.blobs {
164164
let be = SortedEntry {
@@ -172,7 +172,7 @@ impl Extend<IndexPack> for IndexCollector {
172172
EntriesVariants::None => {}
173173
EntriesVariants::Ids(idents) => idents.push(blob.id),
174174
EntriesVariants::FullEntries(entries) => entries.push(be),
175-
};
175+
}
176176
}
177177
}
178178
}

crates/core/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ This crate exposes a few features for controlling dependency usage.
8787
features. *This feature is disabled by default*.
8888
8989
- **clap** - Enables a dependency on the `clap` crate and enables parsing from
90-
the commandline. *This feature is disabled by default*.
90+
the commandline. *This feature is disabled by default*.
9191
9292
- **merge** - Enables support for merging multiple values into one, which
9393
enables the `conflate` dependency. This is needed for parsing commandline
@@ -121,16 +121,16 @@ pub mod vfs;
121121
// rustic_core Public API
122122
pub use crate::{
123123
backend::{
124+
ALL_FILE_TYPES, FileType, ReadBackend, ReadSource, ReadSourceEntry, ReadSourceOpen,
125+
RepositoryBackends, WriteBackend,
124126
decrypt::{compression_level_range, max_compression_level},
125127
ignore::{LocalSource, LocalSourceFilterOptions, LocalSourceSaveOptions},
126128
local_destination::LocalDestination,
127129
node::last_modified_node,
128-
FileType, ReadBackend, ReadSource, ReadSourceEntry, ReadSourceOpen, RepositoryBackends,
129-
WriteBackend, ALL_FILE_TYPES,
130130
},
131131
blob::{
132-
tree::{FindMatches, FindNode, TreeId, TreeStreamerOptions as LsOptions},
133132
BlobId, DataId, PackedId,
133+
tree::{FindMatches, FindNode, TreeId, TreeStreamerOptions as LsOptions},
134134
},
135135
commands::{
136136
backup::{BackupOptions, ParentOptions},
@@ -151,8 +151,8 @@ pub use crate::{
151151
PathList, SnapshotGroup, SnapshotGroupCriterion, SnapshotOptions, StringList,
152152
},
153153
repository::{
154-
command_input::{CommandInput, CommandInputErrorKind},
155154
FullIndex, IndexedFull, IndexedIds, IndexedStatus, IndexedTree, Open, OpenStatus,
156155
Repository, RepositoryOptions,
156+
command_input::{CommandInput, CommandInputErrorKind},
157157
},
158158
};

crates/core/src/repofile/keyfile.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use chrono::{DateTime, Local};
2-
use rand::{thread_rng, RngCore};
2+
use rand::{RngCore, thread_rng};
33
use scrypt::Params;
44
use serde_derive::{Deserialize, Serialize};
55
use serde_with::{base64::Base64, serde_as, skip_serializing_none};
66

77
use crate::{
88
backend::{FileType, ReadBackend},
9-
crypto::{aespoly1305::Key, CryptoKey},
9+
crypto::{CryptoKey, aespoly1305::Key},
1010
error::{ErrorKind, RusticError, RusticResult},
1111
impl_repoid,
1212
};
@@ -393,7 +393,7 @@ pub(crate) fn find_key_in_backend<B: ReadBackend>(
393393
for id in be.list(FileType::Key)? {
394394
match key_from_backend(be, &id.into(), passwd) {
395395
Ok(key) => return Ok(key),
396-
Err(err) if err.is_code("C001") => continue,
396+
Err(err) if err.is_code("C001") => {}
397397
err => return err,
398398
}
399399
}

crates/core/src/repofile/snapshotfile.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ use itertools::Itertools;
1616
use log::info;
1717
use path_dedot::ParseDot;
1818
use serde_derive::{Deserialize, Serialize};
19-
use serde_with::{serde_as, skip_serializing_none, DisplayFromStr};
19+
use serde_with::{DisplayFromStr, serde_as, skip_serializing_none};
2020

2121
use crate::{
22-
backend::{decrypt::DecryptReadBackend, FileType, FindInBackend},
22+
Id,
23+
backend::{FileType, FindInBackend, decrypt::DecryptReadBackend},
2324
blob::tree::TreeId,
2425
error::{ErrorKind, RusticError, RusticResult},
2526
impl_repofile,
2627
progress::Progress,
2728
repofile::RepoFile,
28-
Id,
2929
};
3030

3131
/// [`SnapshotFileErrorKind`] describes the errors that can be returned for `SnapshotFile`s
@@ -738,10 +738,10 @@ impl SnapshotFile {
738738
group
739739
.hostname
740740
.as_ref()
741-
.map_or(true, |val| val == &self.hostname)
742-
&& group.label.as_ref().map_or(true, |val| val == &self.label)
743-
&& group.paths.as_ref().map_or(true, |val| val == &self.paths)
744-
&& group.tags.as_ref().map_or(true, |val| val == &self.tags)
741+
.is_none_or(|val| val == &self.hostname)
742+
&& group.label.as_ref().is_none_or(|val| val == &self.label)
743+
&& group.paths.as_ref().is_none_or(|val| val == &self.paths)
744+
&& group.tags.as_ref().is_none_or(|val| val == &self.tags)
745745
}
746746

747747
/// Get [`SnapshotFile`]s which match the filter grouped by the group criterion
@@ -1021,7 +1021,7 @@ impl FromStr for SnapshotGroupCriterion {
10211021
"label" => crit.label = true,
10221022
"paths" => crit.paths = true,
10231023
"tags" => crit.tags = true,
1024-
"" => continue,
1024+
"" => {}
10251025
v => return Err(SnapshotFileErrorKind::ValueNotAllowed(v.into())),
10261026
}
10271027
}

crates/core/src/repository/warm_up.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn warm_up_repo<P: ProgressBars, S>(
162162
if let Err(err) = backend.warm_up(FileType::Pack, &pack) {
163163
// FIXME: Use error handling
164164
error!("warm-up failed for pack {pack:?}. {}", err.display_log());
165-
};
165+
}
166166
progress_bar_ref.inc(1);
167167
});
168168
}

crates/core/src/vfs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl VfsTree {
153153
tree = new_tree;
154154
} else {
155155
return Err(VfsErrorKind::NameDoesNotExist(name.to_os_string()));
156-
};
156+
}
157157
}
158158
None => {
159159
return Ok(VfsPath::VirtualTree(virtual_tree));

crates/testing/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[package]
22
name = "rustic_testing"
33
version = "0.3.2"
4-
edition = "2021"
4+
edition = "2024"
55
license = "Apache-2.0 OR MIT"
66
publish = true
77
rust-version = { workspace = true }
88
description = """
99
rustic_testuing - library for test support in rustic-rs
1010
"""
11+
resolver = "3"
1112

1213
[dependencies]
1314
aho-corasick = { workspace = true }

0 commit comments

Comments
 (0)