Skip to content

Commit

Permalink
chore: Apply some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
np22-jpg committed Nov 3, 2024
1 parent d39f7d4 commit 812ba11
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion command/src/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl serde::Serialize for Fingerprint {

struct FingerprintVisitor;

impl<'de> Visitor<'de> for FingerprintVisitor {
impl Visitor<'_> for FingerprintVisitor {
type Value = Fingerprint;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion command/src/logging/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn display_status(status: Option<u16>, pretty: bool) -> String {
}
}

impl<'a> fmt::Display for FullTags<'a> {
impl fmt::Display for FullTags<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match (self.concatenated, self.user_agent) {
(None, None) => Ok(()),
Expand Down
8 changes: 6 additions & 2 deletions command/src/proto/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ impl ResponseContent {
fn display(&self, json: bool) -> Result<(), DisplayError> {
let content_type = match &self.content_type {
Some(content_type) => content_type,
None => return Ok(println!("No content")),
None => {
println!("No content");
return Ok(());
}
};

if json {
Expand Down Expand Up @@ -867,7 +870,8 @@ pub fn print_certificates_with_validity(
certs: &CertificatesWithFingerprints,
) -> Result<(), DisplayError> {
if certs.certs.is_empty() {
return Ok(println!("No certificates match your request."));
println!("No certificates match your request.");
return Ok(());
}

let mut table = Table::new();
Expand Down
9 changes: 3 additions & 6 deletions e2e/src/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,7 @@ fn try_max_connections() -> State {
clients.push(client);
}

for i in 0..20 {
let client = &mut clients[i];
for (i, client) in clients.iter_mut().enumerate().take(20) {
if i < 15 {
client.send();
let request = backend.receive(i);
Expand Down Expand Up @@ -1374,17 +1373,15 @@ fn try_max_connections() -> State {
backend.send(i);
println!("request {i}: {request:?}");
}
for i in 15..20 {
let client = &mut clients[i];
for (i, client) in clients.iter_mut().enumerate().take(20).skip(15) {
client.is_connected();
let response = client.receive();
println!("response {i}: {response:?}");
client.is_connected();
// assert!(response.unwrap().starts_with(&expected_response_start));
}

for i in 15..20 {
let client = &mut clients[i];
for client in clients.iter_mut().take(20).skip(15) {
client.is_connected();
let response = client.receive();
println!("response: {response:?}");
Expand Down
6 changes: 3 additions & 3 deletions lib/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ mod tests {
let r = client.read(&mut buffer[index..]);
println!("http client read: {r:?}");
match r {
Err(e) => assert!(false, "client request should not fail. Error: {e:?}"),
Err(e) => unreachable!("client request should not fail. Error: {e:?}"),
Ok(sz) => {
index += sz;
}
Expand Down Expand Up @@ -1237,7 +1237,7 @@ mod tests {
let r = client.read(&mut buffer[index..]);
println!("http client read: {r:?}");
match r {
Err(e) => assert!(false, "client request should not fail. Error: {e:?}"),
Err(e) => unreachable!("client request should not fail. Error: {e:?}"),
Ok(sz) => {
index += sz;
}
Expand Down Expand Up @@ -1266,7 +1266,7 @@ mod tests {
let r2 = client.read(&mut buffer2[index..]);
println!("http client read: {r2:?}");
match r2 {
Err(e) => assert!(false, "client request should not fail. Error: {e:?}"),
Err(e) => unreachable!("client request should not fail. Error: {e:?}"),
Ok(sz) => {
index += sz;
}
Expand Down

0 comments on commit 812ba11

Please sign in to comment.