Skip to content

Commit 61cf0ae

Browse files
committed
Update to edition 2024
Most of this was done with rustfix.
1 parent 8e60df7 commit 61cf0ae

23 files changed

Lines changed: 101 additions & 87 deletions

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- stable
1919
- beta
2020
- nightly
21-
- "1.71.1"
21+
- "1.85.0"
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@v1

interop-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [ "heartsucker <heartsucker@autistici.org>", "Erick Tryzelaar <etryzel
55
description = "TUF library interoperation tests"
66
homepage = "https://github.com/theupdateframework/rust-tuf"
77
repository = "https://github.com/theupdateframework/rust-tuf"
8-
edition = "2021"
8+
edition = "2024"
99
readme = "README.md"
1010
license = "MIT/Apache-2.0"
1111
publish = false

interop-tests/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ fn copy_repo(dir: &Path, step: u8) {
7676

7777
for (path, f) in read_dir_files(&src) {
7878
let path = dst.join(path);
79-
if let Some(parent) = path.parent() {
80-
if !parent.exists() {
79+
if let Some(parent) = path.parent()
80+
&& !parent.exists() {
8181
fs::create_dir_all(parent).unwrap();
8282
}
83-
}
8483
fs::write(path, &f).unwrap();
8584
}
8685
}

interop-tests/src/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use {
22
serde::de::DeserializeOwned,
33
serde::ser::Serialize,
44
tuf::{
5-
pouf::{Pouf, Pouf1},
65
Result,
6+
pouf::{Pouf, Pouf1},
77
},
88
};
99

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
edition = "2018"
1+
edition = "2024"

tuf/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "tuf"
3-
edition = "2021"
3+
edition = "2024"
44
version = "0.3.0-beta14"
5-
rust-version = "1.80.0"
5+
rust-version = "1.85.0"
66
authors = [ "heartsucker <heartsucker@autistici.org>", "Erick Tryzelaar <etryzelaar@google.com>" ]
77
description = "Library for The Update Framework (TUF)"
88
homepage = "https://github.com/theupdateframework/rust-tuf"

tuf/src/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
//! # }
4848
//! ```
4949
50-
use chrono::{offset::Utc, DateTime};
50+
use chrono::{DateTime, offset::Utc};
5151
use futures_io::AsyncRead;
5252
use log::{error, warn};
5353
use std::future::Future;
@@ -845,7 +845,7 @@ where
845845
pub async fn fetch_target(
846846
&mut self,
847847
target: &TargetPath,
848-
) -> Result<impl AsyncRead + Send + Unpin + '_> {
848+
) -> Result<impl AsyncRead + Send + Unpin + '_ + use<'_, D, L, R>> {
849849
self.fetch_target_with_start_time(target, &Utc::now()).await
850850
}
851851

@@ -858,7 +858,7 @@ where
858858
&mut self,
859859
target: &TargetPath,
860860
start_time: &DateTime<Utc>,
861-
) -> Result<impl AsyncRead + Send + Unpin + '_> {
861+
) -> Result<impl AsyncRead + Send + Unpin + '_ + use<'_, D, L, R>> {
862862
let target_description = self
863863
.fetch_target_description_with_start_time(target, start_time)
864864
.await?;
@@ -1304,7 +1304,7 @@ mod test {
13041304
use crate::pouf::Pouf1;
13051305
use crate::repo_builder::RepoBuilder;
13061306
use crate::repository::{
1307-
fetch_metadata_to_string, EphemeralRepository, ErrorRepository, Track, TrackRepository,
1307+
EphemeralRepository, ErrorRepository, Track, TrackRepository, fetch_metadata_to_string,
13081308
};
13091309
use assert_matches::assert_matches;
13101310
use chrono::prelude::*;

tuf/src/crypto.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use {
77
ring::{
88
digest::{self, SHA256, SHA512},
99
rand::SystemRandom,
10-
signature::{Ed25519KeyPair, KeyPair, ED25519},
10+
signature::{ED25519, Ed25519KeyPair, KeyPair},
1111
},
1212
serde::{
13-
de::Error as DeserializeError, ser::Error as SerializeError, Deserialize, Deserializer,
14-
Serialize, Serializer,
13+
Deserialize, Deserializer, Serialize, Serializer, de::Error as DeserializeError,
14+
ser::Error as SerializeError,
1515
},
1616
std::{
1717
cmp::Ordering,
@@ -682,7 +682,7 @@ impl Ord for PublicKey {
682682

683683
impl PartialOrd for PublicKey {
684684
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
685-
Some(self.key_id.cmp(&other.key_id))
685+
Some(self.cmp(other))
686686
}
687687
}
688688

@@ -829,7 +829,7 @@ impl HashAlgorithm {
829829
match self {
830830
HashAlgorithm::Sha256 => Ok(digest::Context::new(&SHA256)),
831831
HashAlgorithm::Sha512 => Ok(digest::Context::new(&SHA512)),
832-
HashAlgorithm::Unknown(ref s) => Err(Error::IllegalArgument(format!(
832+
HashAlgorithm::Unknown(s) => Err(Error::IllegalArgument(format!(
833833
"Unknown hash algorithm: {}",
834834
s
835835
))),

tuf/src/database.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! Components needed to verify TUF metadata and targets.
22
3-
use chrono::{offset::Utc, DateTime};
3+
use chrono::{DateTime, offset::Utc};
44
use std::cmp::Ordering;
55
use std::collections::{HashMap, HashSet};
66
use std::marker::PhantomData;
77

8+
use crate::Result;
89
use crate::crypto::PublicKey;
910
use crate::error::Error;
1011
use crate::metadata::{
@@ -14,7 +15,6 @@ use crate::metadata::{
1415
};
1516
use crate::pouf::Pouf;
1617
use crate::verify::{self, Verified};
17-
use crate::Result;
1818

1919
/// Contains trusted TUF metadata and can be used to verify other metadata and targets.
2020
#[derive(Debug)]

tuf/src/error.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use {
55
crypto::KeyId,
66
metadata::{MetadataPath, MetadataVersion, TargetPath},
77
},
8-
chrono::{offset::Utc, DateTime},
8+
chrono::{DateTime, offset::Utc},
99
std::io,
1010
thiserror::Error,
1111
};
@@ -183,7 +183,9 @@ pub enum Error {
183183

184184
/// The parent metadata expected the child metadata to be at one version, but was found to be at
185185
/// another version.
186-
#[error("metadata {parent_role} expected metadata {child_role} version {expected_version}, but found {new_version}")]
186+
#[error(
187+
"metadata {parent_role} expected metadata {child_role} version {expected_version}, but found {new_version}"
188+
)]
187189
WrongMetadataVersion {
188190
/// The parent metadata that contains the child metadata's version.
189191
parent_role: MetadataPath,

0 commit comments

Comments
 (0)