From c48a52cc1c260947653f1788af6750cb92a305da Mon Sep 17 00:00:00 2001 From: Evaldas Buinauskas Date: Mon, 19 Feb 2024 09:32:09 +0200 Subject: [PATCH] Fix clippy linting issues --- README.md | 22 ++++++++++++++++++++++ src/http_relay.rs | 4 +++- src/lib.rs | 2 -- src/udp_relay.rs | 4 +++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8771992..f1f20b5 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,25 @@ fn track_search_event() { track(event, portal, debug_pin, search_event); } ``` + +## Try locally + +To run UDP example: + +1. Listen for events: + +```shell +nc -kul 5005 +``` + +2. In separate session, run example: + +```shell +cargo run --package vinted_event_tracker --example udp +``` + +3. See captured events, like: + +```json +{"event":"event","portal":"portal","time":1708000488315,"debug_pin":1234,"iteration":945} +``` diff --git a/src/http_relay.rs b/src/http_relay.rs index 763036c..d30a981 100644 --- a/src/http_relay.rs +++ b/src/http_relay.rs @@ -33,7 +33,7 @@ impl Relay for HttpRelay { request = request.header("X-Debug-Pin", debug_pin); } - let _ = tokio::spawn(async move { + let result = tokio::spawn(async move { let response = match request.send().await { Ok(response) => response, Err(error) => { @@ -58,5 +58,7 @@ impl Relay for HttpRelay { } } }); + + drop(result); } } diff --git a/src/lib.rs b/src/lib.rs index 8067662..e0a6771 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ #![deny( warnings, bad_style, - const_err, dead_code, improper_ctypes, non_shorthand_field_patterns, @@ -10,7 +9,6 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_in_public, unconditional_recursion, unused, unused_allocation, diff --git a/src/udp_relay.rs b/src/udp_relay.rs index d710c7b..d3ff2fe 100644 --- a/src/udp_relay.rs +++ b/src/udp_relay.rs @@ -50,7 +50,9 @@ impl Relay for UdpRelay { fn transport(&self, _: Metadata, serialized_event: Vec) { let udp_socket = self.udp_socket.clone(); - let _ = tokio::spawn(async move { udp_socket.send(&serialized_event).await }); + let result = tokio::spawn(async move { udp_socket.send(&serialized_event).await }); + + drop(result); } }