Skip to content

Commit d665527

Browse files
committed
PR feedback (consolidate imports, feature dependencies and better error description)
1 parent ec8a398 commit d665527

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

rcgen/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ zeroize = { version = "1.2", optional = true }
3333
[features]
3434
default = ["crypto", "pem", "ring"]
3535
crypto = []
36-
aws_lc_rs = ["dep:aws-lc-rs"]
37-
ring = ["dep:ring"]
36+
aws_lc_rs = ["crypto", "dep:aws-lc-rs"]
37+
ring = ["crypto", "dep:ring"]
3838

3939

4040
[package.metadata.docs.rs]

rcgen/src/key_pair.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ use yasna::DERWriter;
88
#[cfg(any(feature = "crypto", feature = "pem"))]
99
use crate::error::ExternalError;
1010
#[cfg(feature = "crypto")]
11-
use crate::ring_like::error as ring_error;
12-
#[cfg(feature = "crypto")]
13-
use crate::ring_like::rand::SystemRandom;
14-
#[cfg(feature = "crypto")]
15-
use crate::ring_like::signature::{
16-
self, EcdsaKeyPair, Ed25519KeyPair, KeyPair as RingKeyPair, RsaEncoding, RsaKeyPair,
11+
use crate::ring_like::{
12+
ecdsa_from_pkcs8, error as ring_error,
13+
rand::SystemRandom,
14+
rsa_key_pair_public_modulus_len,
15+
signature::{
16+
self, EcdsaKeyPair, Ed25519KeyPair, KeyPair as RingKeyPair, RsaEncoding, RsaKeyPair,
17+
},
1718
};
1819
#[cfg(feature = "crypto")]
19-
use crate::ring_like::{ecdsa_from_pkcs8, rsa_key_pair_public_modulus_len};
20-
#[cfg(feature = "crypto")]
21-
use crate::sign_algo::algo::*;
22-
#[cfg(feature = "crypto")]
23-
use crate::sign_algo::SignAlgo;
20+
use crate::sign_algo::{algo::*, SignAlgo};
2421
#[cfg(feature = "pem")]
2522
use crate::ENCODE_CONFIG;
2623
use crate::{sign_algo::SignatureAlgorithm, Error};

rcgen/src/ring_like.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ pub(crate) fn rsa_key_pair_public_modulus_len(kp: &signature::RsaKeyPair) -> usi
4040
}
4141

4242
#[cfg(all(feature = "crypto", not(any(feature = "ring", feature = "aws_lc_rs"))))]
43-
compile_error!("At least one of the 'ring' or 'aws_lc_rs' features must be activated");
43+
compile_error!("At least one of the 'ring' or 'aws_lc_rs' features must be activated when the 'crypto' feature is enabled");

0 commit comments

Comments
 (0)