build: update Rust to version 1.88.0

This commit is contained in:
Hendrik Eeckhaut
2025-06-27 16:40:29 +01:00
committed by GitHub
parent fb80aa4cc9
commit db85f68328
35 changed files with 111 additions and 120 deletions

View File

@@ -23,7 +23,7 @@ env:
# 32 seems to be big enough for the foreseeable future
RAYON_NUM_THREADS: 32
GIT_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
RUST_VERSION: 1.87.0
RUST_VERSION: 1.88.0
jobs:
clippy:

View File

@@ -293,7 +293,7 @@ impl fmt::Display for ProtocolConfigError {
}
if let Some(ref source) = self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -36,7 +36,7 @@ impl Display for AesError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -56,7 +56,7 @@ impl fmt::Display for PrfError {
}
if let Some(ref source) = self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -233,7 +233,7 @@ impl std::fmt::Display for AttestationBuilderError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -165,7 +165,7 @@ impl fmt::Display for AttestationError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -186,7 +186,7 @@ impl fmt::Display for PresentationBuilderError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())
@@ -227,7 +227,7 @@ impl fmt::Display for PresentationError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -437,8 +437,7 @@ mod secp256k1eth {
// Based on Ethereum Yellow Paper Appendix F, only values 0 and 1 are valid.
if recid > 1 {
return Err(SignatureError(format!(
"expected recovery id 0 or 1, got {:?}",
recid
"expected recovery id 0 or 1, got {recid:?}"
)));
}
// `ecrecover` expects that 0 and 1 are mapped to 27 and 28.

View File

@@ -283,7 +283,7 @@ impl fmt::Display for TranscriptCommitConfigBuilderError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -161,7 +161,7 @@ impl fmt::Display for EncodingProofError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -200,7 +200,7 @@ impl fmt::Display for TranscriptProofError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())
@@ -546,14 +546,13 @@ impl fmt::Display for TranscriptProofBuilderError {
BuilderErrorKind::Index => f.write_str("index error")?,
BuilderErrorKind::MissingCommitment => f.write_str("commitment error")?,
BuilderErrorKind::Cover { uncovered, kinds } => f.write_str(&format!(
"unable to cover the following ranges in transcript using available {:?} commitments: {uncovered}",
kinds
"unable to cover the following ranges in transcript using available {kinds:?} commitments: {uncovered}"
))?,
BuilderErrorKind::NotSupported => f.write_str("not supported")?,
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())
@@ -904,7 +903,7 @@ mod tests {
assert_eq!(uncovered.recv, Idx(uncovered_recv_rangeset));
}
}
_ => panic!("unexpected error kind: {:?}", kind),
_ => panic!("unexpected error kind: {kind:?}"),
}
}
}

View File

@@ -85,9 +85,9 @@ async fn verify_presentation(example_type: &ExampleType) -> Result<(), Box<dyn s
);
println!("Note that the data which the Prover chose not to disclose are shown as X.\n");
println!("Data sent:\n");
println!("{}\n", sent);
println!("{sent}\n");
println!("Data received:\n");
println!("{}\n", recv);
println!("{recv}\n");
println!("-------------------------------------------------------------------");
Ok(())

View File

@@ -243,14 +243,14 @@ async fn verifier<T: AsyncWrite + AsyncRead + Send + Sync + Unpin + 'static>(
let sent_data = String::from_utf8(sent.clone()).expect("Verifier expected sent data");
sent_data
.find(SERVER_DOMAIN)
.unwrap_or_else(|| panic!("Verification failed: Expected host {}", SERVER_DOMAIN));
.unwrap_or_else(|| panic!("Verification failed: Expected host {SERVER_DOMAIN}"));
// Check received data.
let received = transcript.received_unsafe().to_vec();
let response = String::from_utf8(received.clone()).expect("Verifier expected received data");
response
.find("Herman Melville")
.unwrap_or_else(|| panic!("Expected valid data from {}", SERVER_DOMAIN));
.unwrap_or_else(|| panic!("Expected valid data from {SERVER_DOMAIN}"));
// Check Session info: server name.
assert_eq!(server_name.as_str(), SERVER_DOMAIN);

View File

@@ -15,11 +15,11 @@ pub enum ExampleType {
impl fmt::Display for ExampleType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}
pub fn get_file_path(example_type: &ExampleType, content_type: &str) -> String {
let example_type = example_type.to_string().to_ascii_lowercase();
format!("example-{}.{}.tlsn", example_type, content_type)
format!("example-{example_type}.{content_type}.tlsn")
}

View File

@@ -58,14 +58,14 @@ impl Executor {
Role::Prover => {
let metrics = bench_prover(&provider, &config)
.await
.map_err(|e| RpcError::new(format!("prover bench failed: {}", e)))?;
.map_err(|e| RpcError::new(format!("prover bench failed: {e}")))?;
Ok(CmdOutput::Bench(BenchOutput::Prover { metrics }))
}
Role::Verifier => {
bench_verifier(&provider, &config)
.await
.map_err(|e| RpcError::new(format!("verifier bench failed: {}", e)))?;
.map_err(|e| RpcError::new(format!("verifier bench failed: {e}")))?;
Ok(CmdOutput::Bench(BenchOutput::Verifier))
}

View File

@@ -142,13 +142,13 @@ impl Executor {
tokio::spawn(async move {
while let Some(res) = handler.next().await {
if let Err(e) = res {
eprintln!("chromium error: {:?}", e);
eprintln!("chromium error: {e:?}");
}
}
});
let page = browser
.new_page(&format!("http://{}:{}/index.html", wasm_addr, wasm_port))
.new_page(&format!("http://{wasm_addr}:{wasm_port}/index.html"))
.await?;
page.execute(EnableParams::builder().build()).await?;

View File

@@ -342,8 +342,8 @@ struct VethPair(Veth, Veth);
impl VethPair {
fn new(name: &str) -> Self {
Self(
Veth::new(&format!("{}-0", name)),
Veth::new(&format!("{}-1", name)),
Veth::new(&format!("{name}-0")),
Veth::new(&format!("{name}-1")),
)
}

View File

@@ -472,8 +472,7 @@ fn validate_transcript(
if cf_vd != actual_cf_vd.0.as_slice() {
return Err(MpcTlsError::record_layer(format!(
"client finished verify data does not match output from PRF: {:?} != {:?}",
cf_vd, actual_cf_vd
"client finished verify data does not match output from PRF: {cf_vd:?} != {actual_cf_vd:?}"
)));
}
} else {
@@ -500,8 +499,7 @@ fn validate_transcript(
if sf_vd != actual_sf_vd.0.as_slice() {
return Err(MpcTlsError::record_layer(format!(
"server finished verify data does not match output from PRF: {:?} != {:?}",
sf_vd, actual_sf_vd
"server finished verify data does not match output from PRF: {sf_vd:?} != {actual_sf_vd:?}"
)));
}
} else {
@@ -532,8 +530,7 @@ fn validate_transcript(
}
typ => {
return Err(MpcTlsError::record_layer(format!(
"sent unexpected record content type: {:?}",
typ
"sent unexpected record content type: {typ:?}"
)))
}
}
@@ -561,8 +558,7 @@ fn validate_transcript(
}
typ => {
return Err(MpcTlsError::record_layer(format!(
"received unexpected record content type: {:?}",
typ
"received unexpected record content type: {typ:?}"
)))
}
}

View File

@@ -328,8 +328,7 @@ impl NotaryClient {
ErrorKind::Configuration,
Some(
format!(
"Configuration response status is not OK: {:?}",
configuration_response
"Configuration response status is not OK: {configuration_response:?}"
)
.into(),
),
@@ -443,8 +442,7 @@ impl NotaryClient {
ErrorKind::Internal,
Some(
format!(
"Notarization response status is not SWITCHING_PROTOCOL: {:?}",
notarization_response
"Notarization response status is not SWITCHING_PROTOCOL: {notarization_response:?}"
)
.into(),
),
@@ -508,14 +506,14 @@ fn parse_retry_after(response: &Response<Incoming>) -> Result<u64, ClientError>
let value_str = value.to_str().map_err(|err| {
ClientError::new(
ErrorKind::Internal,
Some(format!("Invalid Retry-After header: {}", err).into()),
Some(format!("Invalid Retry-After header: {err}").into()),
)
})?;
let seconds: u64 = value_str.parse().map_err(|err| {
ClientError::new(
ErrorKind::Internal,
Some(format!("Could not parse Retry-After header as number: {}", err).into()),
Some(format!("Could not parse Retry-After header as number: {err}").into()),
)
})?;
seconds

View File

@@ -99,7 +99,7 @@ pub async fn upgrade_protocol(
.remove(&session_id)
.is_none()
{
let err_msg = format!("Session id {} does not exist", session_id);
let err_msg = format!("Session id {session_id} does not exist");
error!(err_msg);
return NotaryServerError::BadProverRequest(err_msg).into_response();
};

View File

@@ -31,9 +31,9 @@ impl Default for Quote {
impl std::fmt::Debug for QuoteError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
QuoteError::IoError(err) => write!(f, "IoError: {:?}", err),
QuoteError::IoError(err) => write!(f, "IoError: {err:?}"),
QuoteError::IntelQuoteLibrary(err) => {
write!(f, "IntelQuoteLibrary: {}", err)
write!(f, "IntelQuoteLibrary: {err}")
}
}
}

View File

@@ -270,7 +270,7 @@ async fn test_tcp_prover<S: AsyncWrite + AsyncRead + Send + Unpin + 'static>(
tokio::spawn(connection);
let request = Request::builder()
.uri(format!("https://{}/echo", SERVER_DOMAIN))
.uri(format!("https://{SERVER_DOMAIN}/echo"))
.method("POST")
.header("Host", SERVER_DOMAIN)
.header("Connection", "close")
@@ -463,7 +463,7 @@ async fn test_websocket_prover() {
tokio::spawn(connection);
let request = Request::builder()
.uri(format!("https://{}/echo", SERVER_DOMAIN))
.uri(format!("https://{SERVER_DOMAIN}/echo"))
.header("Host", SERVER_DOMAIN)
.header("Connection", "close")
.method("POST")

View File

@@ -80,7 +80,7 @@ impl fmt::Display for ProverError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())

View File

@@ -118,7 +118,7 @@ async fn bytes(
/// parse the JSON data from the file content
fn get_json_value(filecontent: &str) -> Result<Json<Value>, StatusCode> {
Ok(Json(serde_json::from_str(filecontent).map_err(|e| {
eprintln!("Failed to parse JSON data: {}", e);
eprintln!("Failed to parse JSON data: {e}");
StatusCode::INTERNAL_SERVER_ERROR
})?))
}

View File

@@ -99,7 +99,7 @@ async fn test_hyper_ok() {
tokio::spawn(connection);
let request = Request::builder()
.uri(format!("https://{}/echo", SERVER_DOMAIN))
.uri(format!("https://{SERVER_DOMAIN}/echo"))
.header("Host", SERVER_DOMAIN)
.header("Connection", "close")
.method("POST")

View File

@@ -38,8 +38,8 @@ where
times.push(duration_nanos(Instant::now().duration_since(start)));
}
println!("{}", name);
println!("{:?}", times);
println!("{name}");
println!("{times:?}");
}
fn time<F>(mut f: F) -> f64
@@ -231,9 +231,9 @@ static ALL_BENCHMARKS: &[BenchmarkParam] = &[
impl KeyType {
fn path_for(&self, part: &str) -> String {
match self {
KeyType::Rsa => format!("test-ca/rsa/{}", part),
KeyType::Ecdsa => format!("test-ca/ecdsa/{}", part),
KeyType::Ed25519 => format!("test-ca/eddsa/{}", part),
KeyType::Rsa => format!("test-ca/rsa/{part}"),
KeyType::Ecdsa => format!("test-ca/ecdsa/{part}"),
KeyType::Ed25519 => format!("test-ca/eddsa/{part}"),
}
}
@@ -550,7 +550,7 @@ fn lookup_matching_benches(name: &str) -> Vec<&BenchmarkParam> {
.collect();
if r.is_empty() {
panic!("unknown suite {:?}", name);
panic!("unknown suite {name:?}");
}
r
@@ -620,7 +620,7 @@ fn selected_tests(mut args: env::Args) {
},
_ => {
panic!("unsupported mode {:?}", mode);
panic!("unsupported mode {mode:?}");
}
}
}

View File

@@ -120,8 +120,7 @@ async fn version_test(
let server_config = make_server_config_with_versions(KeyType::Rsa, server_versions);
println!(
"version {:?} {:?} -> {:?}",
client_versions, server_versions, result
"version {client_versions:?} {server_versions:?} -> {result:?}"
);
let (mut client, mut server) = make_pair_for_configs(client_config, server_config).await;
@@ -1178,7 +1177,7 @@ async fn client_read_returns_wouldblock_when_no_data() {
async fn client_returns_initial_io_state() {
let (mut client, _) = make_pair(KeyType::Rsa).await;
let io_state = client.process_new_packets().await.unwrap();
println!("IoState is Debug {:?}", io_state);
println!("IoState is Debug {io_state:?}");
assert_eq!(io_state.plaintext_bytes_to_read(), 0);
assert!(!io_state.peer_has_closed());
assert!(io_state.tls_bytes_to_write() > 200);
@@ -1491,7 +1490,7 @@ async fn client_config_is_clone() {
#[tokio::test]
async fn client_connection_is_debug() {
let (client, _) = make_pair(KeyType::Rsa).await;
println!("{:?}", client);
println!("{client:?}");
}
async fn do_exporter_test(client_config: ClientConfig, server_config: ServerConfig) {
@@ -2537,7 +2536,7 @@ async fn test_client_mtu_reduction() {
.unwrap();
client.start().await.unwrap();
let writes = collect_write_lengths(&mut client);
println!("writes at mtu=64: {:?}", writes);
println!("writes at mtu=64: {writes:?}");
assert!(writes.iter().all(|x| *x <= 64));
assert!(writes.len() > 1);
}
@@ -2619,7 +2618,7 @@ async fn bad_client_max_fragment_sizes() {
fn assert_lt(left: usize, right: usize) {
if left >= right {
panic!("expected {} < {}", left, right);
panic!("expected {left} < {right}");
}
}
@@ -2636,7 +2635,7 @@ use tls_client::internal::msgs::message::{Message, MessagePayload};
async fn test_client_rejects_illegal_tls13_ccs() {
fn corrupt_ccs(msg: &mut Message) -> Altered {
if let MessagePayload::ChangeCipherSpec(_) = &mut msg.payload {
println!("seen CCS {:?}", msg);
println!("seen CCS {msg:?}");
return Altered::Raw(vec![0x14, 0x03, 0x03, 0x00, 0x02, 0x01, 0x02]);
}
Altered::InPlace

View File

@@ -98,7 +98,7 @@ pub enum Error {
fn join<T: fmt::Debug>(items: &[T]) -> String {
items
.iter()
.map(|x| format!("{:?}", x))
.map(|x| format!("{x:?}"))
.collect::<Vec<String>>()
.join(" or ")
}
@@ -125,11 +125,11 @@ impl fmt::Display for Error {
join::<HandshakeType>(expect_types)
),
Error::CorruptMessagePayload(ref typ) => {
write!(f, "received corrupt message of type {:?}", typ)
write!(f, "received corrupt message of type {typ:?}")
}
Error::PeerIncompatibleError(ref why) => write!(f, "peer is incompatible: {}", why),
Error::PeerMisbehavedError(ref why) => write!(f, "peer misbehaved: {}", why),
Error::AlertReceived(ref alert) => write!(f, "received fatal alert: {:?}", alert),
Error::PeerIncompatibleError(ref why) => write!(f, "peer is incompatible: {why}"),
Error::PeerMisbehavedError(ref why) => write!(f, "peer misbehaved: {why}"),
Error::AlertReceived(ref alert) => write!(f, "received fatal alert: {alert:?}"),
Error::InvalidCertificateEncoding => {
write!(f, "invalid peer certificate encoding")
}
@@ -140,7 +140,7 @@ impl fmt::Display for Error {
write!(f, "invalid peer certificate signature")
}
Error::InvalidCertificateData(ref reason) => {
write!(f, "invalid peer certificate contents: {}", reason)
write!(f, "invalid peer certificate contents: {reason}")
}
Error::CorruptMessage => write!(f, "received corrupt message"),
Error::NoCertificatesPresented => write!(f, "peer sent no certificates"),
@@ -150,13 +150,13 @@ impl fmt::Display for Error {
Error::PeerSentOversizedRecord => write!(f, "peer sent excess record size"),
Error::HandshakeNotComplete => write!(f, "handshake not complete"),
Error::NoApplicationProtocol => write!(f, "peer doesn't support any known protocol"),
Error::InvalidSct(ref err) => write!(f, "invalid certificate timestamp: {:?}", err),
Error::InvalidSct(ref err) => write!(f, "invalid certificate timestamp: {err:?}"),
Error::FailedToGetCurrentTime => write!(f, "failed to get current time"),
Error::FailedToGetRandomBytes => write!(f, "failed to get random bytes"),
Error::BadMaxFragmentSize => {
write!(f, "the supplied max_fragment_size was too small or large")
}
Error::General(ref err) => write!(f, "unexpected error: {}", err),
Error::General(ref err) => write!(f, "unexpected error: {err}"),
}
}
}
@@ -210,8 +210,8 @@ mod tests {
];
for err in all {
println!("{:?}:", err);
println!(" fmt '{}'", err);
println!("{err:?}:");
println!(" fmt '{err}'");
}
}

View File

@@ -272,7 +272,7 @@ mod tests {
if let Ok(gotval) = got {
assert_eq!(gotval, want);
} else {
panic!("read failed, expected {:?} bytes", want);
panic!("read failed, expected {want:?} bytes");
}
}

View File

@@ -19,7 +19,7 @@ fn reads_random() {
let bytes = [0x01; 32];
let mut rd = Reader::init(&bytes);
let rnd = Random::read(&mut rd).unwrap();
println!("{:?}", rnd);
println!("{rnd:?}");
assert!(!rd.any_left());
}
@@ -50,7 +50,7 @@ fn accepts_short_sessionid() {
let bytes = [1; 2];
let mut rd = Reader::init(&bytes);
let sess = SessionID::read(&mut rd).unwrap();
println!("{:?}", sess);
println!("{sess:?}");
assert!(!sess.is_empty());
assert_eq!(sess.len(), 1);
@@ -62,7 +62,7 @@ fn accepts_empty_sessionid() {
let bytes = [0; 1];
let mut rd = Reader::init(&bytes);
let sess = SessionID::read(&mut rd).unwrap();
println!("{:?}", sess);
println!("{sess:?}");
assert!(sess.is_empty());
assert_eq!(sess.len(), 0);
@@ -75,7 +75,7 @@ fn can_roundtrip_unknown_client_ext() {
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::Unknown(0x1234));
assert_eq!(bytes.to_vec(), ext.get_encoding());
}
@@ -127,7 +127,7 @@ fn can_roundtrip_single_sni() {
let bytes = [0, 0, 0, 7, 0, 5, 0, 0, 2, 0x6c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ServerName);
assert_eq!(bytes.to_vec(), ext.get_encoding());
@@ -138,7 +138,7 @@ fn can_round_trip_mixed_case_sni() {
let bytes = [0, 0, 0, 7, 0, 5, 0, 0, 2, 0x4c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ServerName);
assert_eq!(bytes.to_vec(), ext.get_encoding());
@@ -149,7 +149,7 @@ fn can_roundtrip_other_sni_name_types() {
let bytes = [0, 0, 0, 7, 0, 5, 1, 0, 2, 0x6c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ServerName);
assert_eq!(bytes.to_vec(), ext.get_encoding());
@@ -160,7 +160,7 @@ fn get_single_hostname_returns_none_for_other_sni_name_types() {
let bytes = [0, 0, 0, 7, 0, 5, 1, 0, 2, 0x6c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ServerName);
if let ClientExtension::ServerName(snr) = ext {
@@ -176,7 +176,7 @@ fn can_roundtrip_multiname_sni() {
let bytes = [0, 0, 0, 12, 0, 10, 0, 0, 2, 0x68, 0x69, 0, 0, 2, 0x6c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ServerName);
assert_eq!(bytes.to_vec(), ext.get_encoding());
@@ -224,13 +224,13 @@ fn rejects_truncated_sni() {
fn can_roundtrip_psk_identity() {
let bytes = [0, 0, 0x11, 0x22, 0x33, 0x44];
let psk_id = PresharedKeyIdentity::read(&mut Reader::init(&bytes)).unwrap();
println!("{:?}", psk_id);
println!("{psk_id:?}");
assert_eq!(psk_id.obfuscated_ticket_age, 0x11223344);
assert_eq!(psk_id.get_encoding(), bytes.to_vec());
let bytes = [0, 5, 0x1, 0x2, 0x3, 0x4, 0x5, 0x11, 0x22, 0x33, 0x44];
let psk_id = PresharedKeyIdentity::read(&mut Reader::init(&bytes)).unwrap();
println!("{:?}", psk_id);
println!("{psk_id:?}");
assert_eq!(psk_id.identity.0, vec![0x1, 0x2, 0x3, 0x4, 0x5]);
assert_eq!(psk_id.obfuscated_ticket_age, 0x11223344);
assert_eq!(psk_id.get_encoding(), bytes.to_vec());
@@ -242,7 +242,7 @@ fn can_roundtrip_psk_offer() {
0, 7, 0, 1, 0x99, 0x11, 0x22, 0x33, 0x44, 0, 4, 3, 0x01, 0x02, 0x3,
];
let psko = PresharedKeyOffer::read(&mut Reader::init(&bytes)).unwrap();
println!("{:?}", psko);
println!("{psko:?}");
assert_eq!(psko.identities.len(), 1);
assert_eq!(psko.identities[0].identity.0, vec![0x99]);
@@ -255,7 +255,7 @@ fn can_roundtrip_psk_offer() {
#[test]
fn can_roundtrip_certstatusreq_for_ocsp() {
let ext = ClientExtension::CertificateStatusRequest(CertificateStatusRequest::build_ocsp());
println!("{:?}", ext);
println!("{ext:?}");
let bytes = [
0, 5, // CertificateStatusRequest
@@ -264,7 +264,7 @@ fn can_roundtrip_certstatusreq_for_ocsp() {
];
let csr = ClientExtension::read(&mut Reader::init(&bytes)).unwrap();
println!("{:?}", csr);
println!("{csr:?}");
assert_eq!(csr.get_encoding(), bytes.to_vec());
}
@@ -277,7 +277,7 @@ fn can_roundtrip_certstatusreq_for_other() {
];
let csr = ClientExtension::read(&mut Reader::init(&bytes)).unwrap();
println!("{:?}", csr);
println!("{csr:?}");
assert_eq!(csr.get_encoding(), bytes.to_vec());
}
@@ -286,7 +286,7 @@ fn can_roundtrip_multi_proto() {
let bytes = [0, 16, 0, 8, 0, 6, 2, 0x68, 0x69, 2, 0x6c, 0x6f];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ALProtocolNegotiation);
assert_eq!(ext.get_encoding(), bytes.to_vec());
@@ -305,7 +305,7 @@ fn can_roundtrip_single_proto() {
let bytes = [0, 16, 0, 5, 0, 3, 2, 0x68, 0x69];
let mut rd = Reader::init(&bytes);
let ext = ClientExtension::read(&mut rd).unwrap();
println!("{:?}", ext);
println!("{ext:?}");
assert_eq!(ext.get_type(), ExtensionType::ALProtocolNegotiation);
assert_eq!(bytes.to_vec(), ext.get_encoding());
@@ -423,7 +423,7 @@ fn test_truncated_psk_offer() {
});
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
println!("testing {ext:?} enc {enc:?}");
for l in 0..enc.len() {
if l == 9 {
continue;
@@ -438,7 +438,7 @@ fn test_truncated_psk_offer() {
fn test_truncated_client_hello_is_detected() {
let ch = get_sample_clienthellopayload();
let enc = ch.get_encoding();
println!("testing {:?} enc {:?}", ch, enc);
println!("testing {ch:?} enc {enc:?}");
for l in 0..enc.len() {
println!("len {:?} enc {:?}", l, &enc[..l]);
@@ -455,7 +455,7 @@ fn test_truncated_client_extension_is_detected() {
for ext in &chp.extensions {
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
println!("testing {ext:?} enc {enc:?}");
// "outer" truncation, i.e., where the extension-level length is longer than
// the input
@@ -475,7 +475,7 @@ fn test_truncated_client_extension_is_detected() {
// length, but isn't long enough for the type of extension
for l in 0..(enc.len() - 4) {
put_u16(l as u16, &mut enc[2..]);
println!(" encoding {:?} len {:?}", enc, l);
println!(" encoding {enc:?} len {l:?}");
assert!(ClientExtension::read_bytes(&enc).is_none());
}
}
@@ -565,7 +565,7 @@ fn test_truncated_helloretry_extension_is_detected() {
for ext in &hrr.extensions {
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
println!("testing {ext:?} enc {enc:?}");
// "outer" truncation, i.e., where the extension-level length is longer than
// the input
@@ -582,7 +582,7 @@ fn test_truncated_helloretry_extension_is_detected() {
// length, but isn't long enough for the type of extension
for l in 0..(enc.len() - 4) {
put_u16(l as u16, &mut enc[2..]);
println!(" encoding {:?} len {:?}", enc, l);
println!(" encoding {enc:?} len {l:?}");
assert!(HelloRetryExtension::read_bytes(&enc).is_none());
}
}
@@ -630,7 +630,7 @@ fn test_truncated_server_extension_is_detected() {
for ext in &shp.extensions {
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
println!("testing {ext:?} enc {enc:?}");
// "outer" truncation, i.e., where the extension-level length is longer than
// the input
@@ -650,7 +650,7 @@ fn test_truncated_server_extension_is_detected() {
// length, but isn't long enough for the type of extension
for l in 0..(enc.len() - 4) {
put_u16(l as u16, &mut enc[2..]);
println!(" encoding {:?} len {:?}", enc, l);
println!(" encoding {enc:?} len {l:?}");
assert!(ServerExtension::read_bytes(&enc).is_none());
}
}
@@ -966,8 +966,8 @@ fn can_roundtrip_all_tls12_handshake_payloads() {
assert!(!rd.any_left());
assert_eq!(hm.get_encoding(), other.get_encoding());
println!("{:?}", hm);
println!("{:?}", other);
println!("{hm:?}");
println!("{other:?}");
}
}
@@ -975,7 +975,7 @@ fn can_roundtrip_all_tls12_handshake_payloads() {
fn can_detect_truncation_of_all_tls12_handshake_payloads() {
for hm in get_all_tls12_handshake_payloads().iter() {
let mut enc = hm.get_encoding();
println!("test {:?} enc {:?}", hm, enc);
println!("test {hm:?} enc {enc:?}");
// outer truncation
for l in 0..enc.len() {
@@ -985,7 +985,7 @@ fn can_detect_truncation_of_all_tls12_handshake_payloads() {
// inner truncation
for l in 0..enc.len() - 4 {
put_u24(l as u32, &mut enc[1..]);
println!(" check len {:?} enc {:?}", l, enc);
println!(" check len {l:?} enc {enc:?}");
match (hm.typ, l) {
(HandshakeType::ClientHello, 41)
@@ -1107,8 +1107,8 @@ fn can_roundtrip_all_tls13_handshake_payloads() {
assert!(!rd.any_left());
assert_eq!(hm.get_encoding(), other.get_encoding());
println!("{:?}", hm);
println!("{:?}", other);
println!("{hm:?}");
println!("{other:?}");
}
}
@@ -1122,7 +1122,7 @@ fn put_u24(u: u32, b: &mut [u8]) {
fn can_detect_truncation_of_all_tls13_handshake_payloads() {
for hm in get_all_tls13_handshake_payloads().iter() {
let mut enc = hm.get_encoding();
println!("test {:?} enc {:?}", hm, enc);
println!("test {hm:?} enc {enc:?}");
// outer truncation
for l in 0..enc.len() {
@@ -1132,7 +1132,7 @@ fn can_detect_truncation_of_all_tls13_handshake_payloads() {
// inner truncation
for l in 0..enc.len() - 4 {
put_u24(l as u32, &mut enc[1..]);
println!(" check len {:?} enc {:?}", l, enc);
println!(" check len {l:?} enc {enc:?}");
match (hm.typ, l) {
(HandshakeType::ClientHello, 41)
@@ -1159,7 +1159,7 @@ fn cannot_read_messagehash_from_network() {
typ: HandshakeType::MessageHash,
payload: HandshakePayload::MessageHash(Payload::new(vec![1, 2, 3])),
};
println!("mh {:?}", mh);
println!("mh {mh:?}");
let enc = mh.get_encoding();
assert!(HandshakeMessagePayload::read_bytes(&enc).is_none());
}

View File

@@ -31,7 +31,7 @@ fn test_read_fuzz_corpus() {
let mut rd = Reader::init(&bytes);
let msg = OpaqueMessage::read(&mut rd).unwrap().into_plain_message();
println!("{:?}", msg);
println!("{msg:?}");
let msg = match Message::try_from(msg) {
Ok(msg) => msg,
@@ -64,7 +64,7 @@ fn can_read_safari_client_hello() {
\x01\x00\x00\x0a\x00\x0a\x00\x08\x00\x1d\x00\x17\x00\x18\x00\x19";
let mut rd = Reader::init(bytes);
let m = OpaqueMessage::read(&mut rd).unwrap();
println!("m = {:?}", m);
println!("m = {m:?}");
assert!(Message::try_from(m.into_plain_message()).is_err());
}
@@ -92,8 +92,8 @@ fn construct_all_types() {
];
for &bytes in samples.iter() {
let m = OpaqueMessage::read(&mut Reader::init(bytes)).unwrap();
println!("m = {:?}", m);
println!("m = {m:?}");
let m = Message::try_from(m.into_plain_message());
println!("m' = {:?}", m);
println!("m' = {m:?}");
}
}

View File

@@ -291,6 +291,6 @@ mod test {
#[test]
fn test_scs_is_debug() {
println!("{:?}", ALL_CIPHER_SUITES);
println!("{ALL_CIPHER_SUITES:?}");
}
}

View File

@@ -31,7 +31,7 @@ impl fmt::Debug for BsDebug<'_> {
} else if (0x20..0x7f).contains(&c) {
write!(fmt, "{}", c as char)?;
} else {
write!(fmt, "\\x{:02x}", c)?;
write!(fmt, "\\x{c:02x}")?;
}
}
write!(fmt, "\"")?;

View File

@@ -457,7 +457,7 @@ pub(crate) fn pki_error(error: webpki::Error) -> Error {
UnsupportedSignatureAlgorithm | UnsupportedSignatureAlgorithmForPublicKey => {
Error::InvalidCertificateSignatureType
}
e => Error::InvalidCertificateData(format!("invalid peer certificate: {}", e)),
e => Error::InvalidCertificateData(format!("invalid peer certificate: {e}")),
}
}
@@ -493,7 +493,7 @@ fn convert_scheme(scheme: SignatureScheme) -> Result<SignatureAlgorithms, Error>
SignatureScheme::RSA_PSS_SHA512 => Ok(RSA_PSS_SHA512),
_ => {
let error_msg = format!("received unadvertised sig scheme {:?}", scheme);
let error_msg = format!("received unadvertised sig scheme {scheme:?}");
Err(Error::PeerMisbehavedError(error_msg))
}
}
@@ -543,7 +543,7 @@ fn convert_alg_tls13(
RSA_PSS_SHA384 => Ok(&webpki::RSA_PSS_2048_8192_SHA384_LEGACY_KEY),
RSA_PSS_SHA512 => Ok(&webpki::RSA_PSS_2048_8192_SHA512_LEGACY_KEY),
_ => {
let error_msg = format!("received unsupported sig scheme {:?}", scheme);
let error_msg = format!("received unsupported sig scheme {scheme:?}");
Err(Error::PeerMisbehavedError(error_msg))
}
}

View File

@@ -75,7 +75,7 @@ impl fmt::Display for VerifierError {
}
if let Some(source) = &self.source {
write!(f, " caused by: {}", source)?;
write!(f, " caused by: {source}")?;
}
Ok(())