From 48c9a5b39c51a7019ca35037371a55a6805d3e03 Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Sat, 11 Sep 2021 22:00:34 +0200 Subject: [PATCH] Fix clippy lints. --- src/domain/subscriber_name.rs | 2 +- src/routes/newsletters.rs | 2 +- tests/api/helpers.rs | 4 ++-- tests/api/newsletter.rs | 2 +- tests/api/subscriptions.rs | 2 +- tests/api/subscriptions_confirm.rs | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/domain/subscriber_name.rs b/src/domain/subscriber_name.rs index b3c6540..f3c0e77 100644 --- a/src/domain/subscriber_name.rs +++ b/src/domain/subscriber_name.rs @@ -72,7 +72,7 @@ mod tests { #[test] fn names_containing_an_invalid_character_are_rejected() { - for name in vec!['/', '(', ')', '"', '<', '>', '\\', '{', '}'] { + for name in &['/', '(', ')', '"', '<', '>', '\\', '{', '}'] { let name = name.to_string(); assert_err!(SubscriberName::parse(name)); } diff --git a/src/routes/newsletters.rs b/src/routes/newsletters.rs index d7b0633..fdf97be 100644 --- a/src/routes/newsletters.rs +++ b/src/routes/newsletters.rs @@ -117,7 +117,7 @@ async fn validate_credentials( .to_string(); if let Some((stored_user_id, stored_password_hash)) = - get_stored_credentials(&credentials.username, &pool) + get_stored_credentials(&credentials.username, pool) .await .map_err(PublishError::UnexpectedError)? { diff --git a/tests/api/helpers.rs b/tests/api/helpers.rs index 1a32163..d7f140f 100644 --- a/tests/api/helpers.rs +++ b/tests/api/helpers.rs @@ -75,8 +75,8 @@ impl TestApp { confirmation_link }; - let html = get_link(&body["HtmlBody"].as_str().unwrap()); - let plain_text = get_link(&body["TextBody"].as_str().unwrap()); + let html = get_link(body["HtmlBody"].as_str().unwrap()); + let plain_text = get_link(body["TextBody"].as_str().unwrap()); ConfirmationLinks { html, plain_text } } } diff --git a/tests/api/newsletter.rs b/tests/api/newsletter.rs index 0bf545c..43074c3 100644 --- a/tests/api/newsletter.rs +++ b/tests/api/newsletter.rs @@ -25,7 +25,7 @@ async fn create_unconfirmed_subscriber(app: &TestApp) -> ConfirmationLinks { .unwrap() .pop() .unwrap(); - app.get_confirmation_links(&email_request) + app.get_confirmation_links(email_request) } async fn create_confirmed_subscriber(app: &TestApp) { diff --git a/tests/api/subscriptions.rs b/tests/api/subscriptions.rs index 3b2e169..e588a19 100644 --- a/tests/api/subscriptions.rs +++ b/tests/api/subscriptions.rs @@ -96,7 +96,7 @@ async fn subscribe_sends_a_confirmation_email_with_a_link() { // Assert let email_request = &app.email_server.received_requests().await.unwrap()[0]; - let confirmation_links = app.get_confirmation_links(&email_request); + let confirmation_links = app.get_confirmation_links(email_request); // The two links should be identical assert_eq!(confirmation_links.html, confirmation_links.plain_text); diff --git a/tests/api/subscriptions_confirm.rs b/tests/api/subscriptions_confirm.rs index 3d3f5f6..7ee4e0f 100644 --- a/tests/api/subscriptions_confirm.rs +++ b/tests/api/subscriptions_confirm.rs @@ -30,7 +30,7 @@ async fn the_link_returned_by_subscribe_returns_a_200_if_called() { app.post_subscriptions(body.into()).await; let email_request = &app.email_server.received_requests().await.unwrap()[0]; - let confirmation_links = app.get_confirmation_links(&email_request); + let confirmation_links = app.get_confirmation_links(email_request); // Act let response = reqwest::get(confirmation_links.html).await.unwrap(); @@ -53,7 +53,7 @@ async fn clicking_on_the_confirmation_link_confirms_a_subscriber() { app.post_subscriptions(body.into()).await; let email_request = &app.email_server.received_requests().await.unwrap()[0]; - let confirmation_links = app.get_confirmation_links(&email_request); + let confirmation_links = app.get_confirmation_links(email_request); // Act reqwest::get(confirmation_links.html)