Skip to content

Commit f053215

Browse files
boquan-fangBoquan Fang
andauthored
chore: apply clippy and fmt fixes (#5386)
Co-authored-by: Boquan Fang <bqfang@amazon.com>
1 parent 3ebd384 commit f053215

File tree

9 files changed

+13
-18
lines changed

9 files changed

+13
-18
lines changed

bindings/rust/extended/s2n-tls-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn env<N: AsRef<str>>(name: N) -> String {
2323

2424
fn option_env<N: AsRef<str>>(name: N) -> Option<String> {
2525
let name = name.as_ref();
26-
println!("cargo:rerun-if-env-changed={}", name);
26+
println!("cargo:rerun-if-env-changed={name}");
2727
std::env::var(name).ok()
2828
}
2929

@@ -206,7 +206,7 @@ impl Default for Libcrypto {
206206
if let Some(version) = version.strip_suffix("_INCLUDE") {
207207
let version = version.to_string();
208208

209-
println!("cargo:rerun-if-env-changed={}", name);
209+
println!("cargo:rerun-if-env-changed={name}");
210210

211211
let include = value;
212212
let root = env(format!("DEP_AWS_LC_{version}_ROOT"));

bindings/rust/extended/s2n-tls-sys/tests/s2n_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn s2n_init_test() {
1414
let error = *s2n_errno_location();
1515
let msg = s2n_strerror_name(error);
1616
let msg = std::ffi::CStr::from_ptr(msg);
17-
panic!("s2n did not initialize correctly: {:?}", msg);
17+
panic!("s2n did not initialize correctly: {msg:?}");
1818
}
1919
}
2020
}

bindings/rust/extended/s2n-tls-tokio/tests/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub static TEST_STR: &str = "hello world";
3838

3939
pub async fn get_streams() -> Result<(TcpStream, TcpStream), tokio::io::Error> {
4040
let localhost = "127.0.0.1".to_owned();
41-
let listener = TcpListener::bind(format!("{}:0", localhost)).await?;
41+
let listener = TcpListener::bind(format!("{localhost}:0")).await?;
4242
let addr = listener.local_addr()?;
4343
let client_stream = TcpStream::connect(&addr).await?;
4444
let (server_stream, _) = listener.accept().await?;

bindings/rust/extended/s2n-tls/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ mod tests {
475475
let app_error = error.application_error().unwrap();
476476
let _custom_error = app_error.downcast_ref::<CustomError>().unwrap();
477477

478-
let display = format!("{}", error);
478+
let display = format!("{error}");
479479
assert_eq!(display, "custom error");
480-
let debug = format!("{:?}", error);
480+
let debug = format!("{error:?}");
481481
assert_eq!(debug, "CustomError");
482482
}
483483

bindings/rust/extended/s2n-tls/src/testing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl CertKeyPair {
124124
/// ```
125125
pub fn from_path(prefix: &str, chain: &str, key: &str, ca: &str) -> Self {
126126
let cert_path = format!("{}{prefix}{chain}.pem", Self::TEST_PEMS_PATH);
127-
println!("{:?}", cert_path);
127+
println!("{cert_path:?}");
128128
let key_path = format!("{}{prefix}{key}.pem", Self::TEST_PEMS_PATH);
129129
let ca_path = format!("{}{prefix}{ca}.pem", Self::TEST_PEMS_PATH);
130130
let cert = std::fs::read(&cert_path)

tests/pcap/build.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ fn add_github_urls(
7575
assert!(hex::decode(commit).is_ok());
7676

7777
for file in files {
78-
let url = format!(
79-
"https://raw.githubusercontent.com/{}/{}/{}/{}",
80-
repo, commit, path, file
81-
);
78+
let url = format!("https://raw.githubusercontent.com/{repo}/{commit}/{path}/{file}");
8279
let name = format!("{}_{}", repo.replace('/', "_"), file);
8380
if output.insert(name, url).is_some() {
8481
panic!("Duplicate download path for {repo}:{file}")
@@ -115,11 +112,9 @@ fn assert_tshark_version() -> Result<()> {
115112
let min_version = Version::new(4, 2, 0);
116113
assert!(
117114
version >= &min_version,
118-
"tshark {} required. tshark {} found.",
119-
min_version,
120-
version
115+
"tshark {min_version} required. tshark {version} found."
121116
);
122-
println!("tshark version: {}", version);
117+
println!("tshark version: {version}");
123118
Ok(())
124119
}
125120

tests/pcap/src/handshake_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl HandshakeMessage {
120120
fn from_packet(packet: Packet, tcp_packets: &HashMap<PacketId, Packet>) -> Result<Self> {
121121
let packet_id = packet.id();
122122
Self::parse_fields(packet, tcp_packets)
123-
.with_context(|| format!("Failed to parse frame {}", packet_id))
123+
.with_context(|| format!("Failed to parse frame {packet_id}"))
124124
}
125125

126126
pub fn builder() -> Builder {

tests/pcap/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mod tests {
3939
println!("All pcaps: ");
4040
let paths: HashSet<String> = pcaps
4141
.map(|file_str| {
42-
println!("{}", file_str);
42+
println!("{file_str}");
4343
let (path, _file) = file_str.rsplit_once("/").expect("No path");
4444
path.to_owned()
4545
})

tests/pcap/tests/s2n_client_hellos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use s2n_tls::fingerprint;
1111
fn get_s2n_hello(pcap_hello: &PcapHello) -> Result<Box<S2NHello>> {
1212
let bytes = pcap_hello.message().bytes();
1313
let r = S2NHello::parse_client_hello(&bytes);
14-
println!("Result: {:?}", r);
14+
println!("Result: {r:?}");
1515
Ok(r?)
1616
}
1717

0 commit comments

Comments
 (0)