Skip to content

Commit

Permalink
Upgrade to edition 2021. (#1217)
Browse files Browse the repository at this point in the history
This PR upgrades the codebase to Rust edition 2021.

This mostly just means removing a number of use statements for TryFrom and
TryInto. There are no actual code changes.
  • Loading branch information
partim authored Jun 25, 2024
1 parent 45eb8f8 commit 7f6cead
Show file tree
Hide file tree
Showing 18 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Note: some of these values are also used when building Debian packages below.
name = "krill"
version = "0.14.5-dev"
edition = "2018"
edition = "2021"
rust-version = "1.70"
authors = ["NLnet Labs <[email protected]>"]
description = "Resource Public Key Infrastructure (RPKI) daemon"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/ta_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Trust Anchor Client for managing the TA Proxy *and* Signer
use std::{convert::TryInto, env, path::PathBuf, str::FromStr, sync::Arc};
use std::{env, path::PathBuf, str::FromStr, sync::Arc};

use bytes::Bytes;
use clap::{App, Arg, ArgMatches, SubCommand};
Expand Down
2 changes: 0 additions & 2 deletions src/commons/api/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//! can have access without needing to depend on the full krill_ca module.
use std::collections::HashMap;
use std::convert::TryFrom;
use std::ops::{self};
use std::str::FromStr;
use std::sync::Arc;
Expand Down Expand Up @@ -2180,7 +2179,6 @@ impl fmt::Display for RtaPrepResponse {
#[cfg(test)]
mod test {
use bytes::Bytes;
use std::convert::TryFrom;

use rpki::crypto::PublicKeyFormat;

Expand Down
1 change: 0 additions & 1 deletion src/commons/api/rrdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//! withdraw elements, as well as the notification, snapshot and delta file
//! definitions.
use std::{
convert::{TryFrom, TryInto},
fmt, io,
ops::{Add, AddAssign, Deref},
path::PathBuf,
Expand Down
2 changes: 0 additions & 2 deletions src/commons/crypto/signing/misc.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Support for signing mft, crl, certificates, roas..
//! Common objects for TAs and CAs
use std::convert::TryFrom;

use rpki::{
ca::{csr::RpkiCaCsr, provisioning::RequestResourceLimit},
crypto::{KeyIdentifier, PublicKey},
Expand Down
1 change: 0 additions & 1 deletion src/commons/crypto/signing/signers/kmip/signer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::{TryFrom, TryInto},
net::TcpStream,
ops::Deref,
path::PathBuf,
Expand Down
1 change: 0 additions & 1 deletion src/commons/crypto/signing/signers/pkcs11/signer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::{TryFrom, TryInto},
marker::PhantomData,
path::Path,
sync::{Arc, RwLock, RwLockReadGuard},
Expand Down
2 changes: 0 additions & 2 deletions src/daemon/auth/common/crypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ impl CryptState {
}

pub fn from_key_vec(key_vec: Vec<u8>) -> KrillResult<CryptState> {
// Rust 1.43+ compatible
use std::convert::TryInto;
let boxed_array: Box<[u8; CHACHA20_KEY_BYTE_LEN]> = key_vec
.into_boxed_slice()
.try_into()
Expand Down
1 change: 0 additions & 1 deletion src/daemon/ca/certauth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
ops::Deref,
sync::Arc,
vec,
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/ca/manager.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, convert::TryFrom, ops::Deref, str::FromStr, sync::Arc};
use std::{collections::HashMap, ops::Deref, str::FromStr, sync::Arc};

use bytes::Bytes;
use chrono::Duration;
Expand Down
1 change: 0 additions & 1 deletion src/daemon/http/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{io, str::from_utf8, str::FromStr};
use std::convert::TryInto;

use bytes::Bytes;
use serde::{de::DeserializeOwned, Serialize};
Expand Down
1 change: 0 additions & 1 deletion src/daemon/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//!
use std::{env, process};
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::File;
use std::io::Read;
use std::net::SocketAddr;
Expand Down
1 change: 0 additions & 1 deletion src/pubd/repository.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
borrow::Cow,
collections::{HashMap, VecDeque},
convert::TryFrom,
fmt, fs,
path::{Path, PathBuf},
str::FromStr,
Expand Down
2 changes: 1 addition & 1 deletion src/ta/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// is handled by the Trust Anchor Signer instead.
use super::*;

use std::{collections::HashMap, convert::TryFrom, fmt, sync::Arc};
use std::{collections::HashMap, fmt, sync::Arc};

use chrono::Duration;
use rpki::{
Expand Down
2 changes: 1 addition & 1 deletion src/ta/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! The proxy makes sign requests for the signer to sign.
use super::*;

use std::{collections::HashMap, convert::TryFrom, fmt, sync::Arc};
use std::{collections::HashMap, fmt, sync::Arc};

use chrono::SecondsFormat;
use rpki::{
Expand Down
4 changes: 3 additions & 1 deletion src/upgrades/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
//! - Updating the format of commands or events
//! - Export / Import data
use std::{collections::HashMap, convert::TryInto, fmt, str::FromStr};
use std::fmt;
use std::collections::HashMap;
use std::str::FromStr;

use serde::{de::DeserializeOwned, Deserialize};

Expand Down
2 changes: 0 additions & 2 deletions src/upgrades/pre_0_10_0/cas_migration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use rpki::ca::idexchange::MyHandle;
use rpki::{ca::idexchange::CaHandle, repository::x509::Time};

Expand Down
1 change: 0 additions & 1 deletion src/upgrades/pre_0_10_0/old_events.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
fmt,
};

Expand Down

0 comments on commit 7f6cead

Please sign in to comment.