Skip to content

Commit 4cf5a4b

Browse files
committed
Apply nightly clippy suggestions
1 parent 7016d36 commit 4cf5a4b

File tree

8 files changed

+12
-22
lines changed

8 files changed

+12
-22
lines changed

librustls/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ fn main() {
3232
let pkg_version = env!("CARGO_PKG_VERSION");
3333
writeln!(
3434
&mut f,
35-
r#"const RUSTLS_FFI_VERSION: &str = "rustls-ffi/{}/rustls/{}/{}";"#,
36-
pkg_version, RUSTLS_CRATE_VERSION, rustls_crypto_provider
35+
r#"const RUSTLS_FFI_VERSION: &str = "rustls-ffi/{pkg_version}/rustls/{RUSTLS_CRATE_VERSION}/{rustls_crypto_provider}";"#,
3736
)
3837
.expect("Could not write file");
3938

librustls/src/cipher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ mod tests {
7777
let name = rustls_supported_ciphersuite_get_name(suite);
7878
let name = unsafe { name.to_str() };
7979
let proto = rustls_supported_ciphersuite_protocol_version(suite);
80-
println!("{}: {} {:?}", i, name, proto);
80+
println!("{i}: {name} {proto:?}");
8181
}
8282
}
8383
}

librustls/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ mod tests {
859859
&mut conn,
860860
);
861861
if !matches!(result, rustls_result::Ok) {
862-
panic!("expected RUSTLS_RESULT_OK, got {:?}", result);
862+
panic!("expected RUSTLS_RESULT_OK, got {result:?}");
863863
}
864864
assert!(!rustls_connection::rustls_connection_wants_read(conn));
865865
assert!(rustls_connection::rustls_connection_wants_write(conn));
@@ -919,7 +919,7 @@ mod tests {
919919
&mut conn,
920920
);
921921
if !matches!(result, rustls_result::Ok) {
922-
panic!("expected RUSTLS_RESULT_OK, got {:?}", result);
922+
panic!("expected RUSTLS_RESULT_OK, got {result:?}");
923923
}
924924
rustls_server_cert_verifier::rustls_server_cert_verifier_free(verifier);
925925
}

librustls/src/rslice.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,7 @@ mod tests {
267267
fn test_rustls_str_debug() {
268268
let s = "abcd";
269269
let rs: rustls_str = s.try_into().unwrap();
270-
assert_eq!(
271-
format!("{:?}", rs),
272-
r#"rustls_str { data: "abcd", len: 4 }"#
273-
);
270+
assert_eq!(format!("{rs:?}"), r#"rustls_str { data: "abcd", len: 4 }"#);
274271
}
275272
}
276273

librustls/src/server.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,7 @@ mod tests {
777777
&mut certified_key,
778778
);
779779
if !matches!(result, rustls_result::Ok) {
780-
panic!(
781-
"expected RUSTLS_RESULT_OK from rustls_certified_key_build, got {:?}",
782-
result
783-
);
780+
panic!("expected RUSTLS_RESULT_OK from rustls_certified_key_build, got {result:?}");
784781
}
785782
rustls_server_config_builder::rustls_server_config_builder_set_certified_keys(
786783
builder,
@@ -827,10 +824,7 @@ mod tests {
827824
&mut certified_key,
828825
);
829826
if !matches!(result, rustls_result::Ok) {
830-
panic!(
831-
"expected RUSTLS_RESULT_OK from rustls_certified_key_build, got {:?}",
832-
result
833-
);
827+
panic!("expected RUSTLS_RESULT_OK from rustls_certified_key_build, got {result:?}");
834828
}
835829
rustls_server_config_builder::rustls_server_config_builder_set_certified_keys(
836830
builder,
@@ -847,7 +841,7 @@ mod tests {
847841
let mut conn = null_mut();
848842
let result = rustls_server_config::rustls_server_connection_new(config, &mut conn);
849843
if !matches!(result, rustls_result::Ok) {
850-
panic!("expected RUSTLS_RESULT_OK, got {:?}", result);
844+
panic!("expected RUSTLS_RESULT_OK, got {result:?}");
851845
}
852846
assert!(rustls_connection::rustls_connection_wants_read(conn));
853847
assert!(!rustls_connection::rustls_connection_wants_write(conn));

librustls/tests/client_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const PORT: &str = "8443";
88
#[test]
99
#[ignore] // This test requires the client & server binaries be present.
1010
fn client_server_integration() {
11-
let server_addr = format!("{}:{}", HOST, PORT);
11+
let server_addr = format!("{HOST}:{PORT}");
1212
if TcpStream::connect(&server_addr).is_ok() {
1313
panic!("cannot run tests; something is already listening on {server_addr}");
1414
}

tools/src/bin/docgen/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn find_doc_items(root: Node, source_code: &[u8]) -> Result<ApiDocs, Box<dyn Err
139139
}
140140
}
141141
if errors > 0 {
142-
return Err(format!("{} errors produced while documenting header file", errors).into());
142+
return Err(format!("{errors} errors produced while documenting header file").into());
143143
}
144144

145145
let mut api = ApiDocs::default();

tools/src/bin/ech_fetch/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustls::pki_types::EchConfigListBytes;
2525
async fn main() -> Result<(), Box<dyn Error>> {
2626
let mut args = env::args().skip(1);
2727
let domain = args.next().unwrap_or("research.cloudflare.com".to_string());
28-
let output_path = args.next().unwrap_or(format!("{}.ech.configs.bin", domain));
28+
let output_path = args.next().unwrap_or(format!("{domain}.ech.configs.bin"));
2929

3030
let resolver = Resolver::builder_with_config(
3131
ResolverConfig::google_https(),
@@ -48,7 +48,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
4848
}
4949
// And print a comma separated list of the file paths.
5050
let paths = (1..=all_lists.len())
51-
.map(|i| format!("{}.{}", output_path, i))
51+
.map(|i| format!("{output_path}.{i}"))
5252
.collect::<Vec<_>>()
5353
.join(",");
5454
println!("{paths}")

0 commit comments

Comments
 (0)