Skip to content

Commit 5eeb107

Browse files
committed
fix a few clippy errors
Signed-off-by: Lance-Drane <[email protected]>
1 parent 73f4735 commit 5eeb107

File tree

9 files changed

+22
-10
lines changed

9 files changed

+22
-10
lines changed

proxy-http-server/src/routes/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub async fn publish_message(
5858
.publish_message(&topic, data)
5959
.await
6060
{
61-
Ok(_) => Ok((StatusCode::CREATED, "Success".to_string())),
61+
Ok(()) => Ok((StatusCode::CREATED, "Success".to_string())),
6262
Err(_) => Err((
6363
StatusCode::INTERNAL_SERVER_ERROR,
6464
"server fault, message not published".to_string(),

shared-deps/src/protocols/amqp/init.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use crate::{
88
};
99

1010
/// Sets up the AMQP proto handlers, and verifies that we can connect to the AMQP broker.
11+
///
12+
/// # Errors
13+
/// - If we can't make an initial connection to the broker, return Err.
1114
pub async fn init_amqp_proto_handlers(
1215
broker_config: &BrokerSettings,
1316
application_name: &'static str,

shared-deps/src/protocols/amqp/publish.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
#[derive(Clone)]
1111
pub struct AmqpPublishProtoHandler {
1212
pool: Pool,
13-
/// application_name is used for the hardcoded queue name and for debugging purposes
13+
/// `application_name` is used for the hardcoded queue name and for debugging purposes
1414
application_name: &'static str,
1515
}
1616

@@ -23,6 +23,7 @@ impl std::fmt::Debug for AmqpPublishProtoHandler {
2323
}
2424

2525
impl AmqpPublishProtoHandler {
26+
#[must_use]
2627
pub fn new(pool: Pool, application_name: &'static str) -> Self {
2728
Self {
2829
pool,

shared-deps/src/protocols/amqp/subscribe.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::protocols::interfaces::{HttpBroadcast, SubscribeProtoHandler};
1414

1515
pub struct AmqpSubscribeProtoHandler {
1616
pool: Pool,
17-
/// application_name is used for the hardcoded queue name and for debugging purposes
17+
/// `application_name` is used for the hardcoded queue name and for debugging purposes
1818
application_name: &'static str,
1919
}
2020

@@ -27,6 +27,7 @@ impl std::fmt::Debug for AmqpSubscribeProtoHandler {
2727
}
2828

2929
impl AmqpSubscribeProtoHandler {
30+
#[must_use]
3031
pub fn new(pool: Pool, application_name: &'static str) -> Self {
3132
Self {
3233
pool,

shared-deps/src/protocols/interfaces.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ pub trait HttpBroadcast {
1313
}
1414

1515
/// Trait which determines how to publish a message. Should usually show up as a reaction to receiving an HTTP event or request.
16-
/// Note that whatever implements PublishProtoHandler should generally implement Clone as well.
16+
/// Note that whatever implements `PublishProtoHandler` should generally implement Clone as well.
1717
pub trait PublishProtoHandler {
1818
/// this is meant to verify errors in the message before publishing
19+
///
20+
/// # Errors
21+
/// - return an error message if message verification failed.
1922
fn preverify_publish(&self, topic: &str) -> Result<(), String>;
2023
/// the assumption is that once this function is called, all faults lie in the broker (and not the parameters)
2124
fn publish_message(
@@ -27,8 +30,8 @@ pub trait PublishProtoHandler {
2730

2831
/// Trait which determines how to subscribe to a message. Usually runs in its own thread and uses an [`HttpBroadcast`] to send the message over an HTTP channel.
2932
pub trait SubscribeProtoHandler {
30-
/// this should start a subscribe loop in a tokio::spawn thread, and return the JoinHandle.
31-
/// this consumes the ProtoHandler itself after being called.
33+
/// this should start a subscribe loop in a [`tokio::spawn`] thread, and return the [`tokio::task::JoinHandle`] .
34+
/// this consumes the `SubscribeProtoHandler` itself after being called.
3235
fn begin_subscribe_loop(
3336
self,
3437
config_topic: String,

shared-deps/src/protocols/mqtt/init.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use crate::{
1212
};
1313

1414
/// Sets up the MQTT proto handlers, and verifies that we can connect to the MQTT broker.
15+
///
16+
/// # Errors
17+
/// - If we can't make an initial connection to the broker, return Err.
1518
pub async fn init_mqtt_proto_handlers(
1619
broker_config: &BrokerSettings,
1720
application_name: &'static str,

shared-deps/src/protocols/mqtt/publish.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::protocols::proxy::is_routing_key_compliant;
66
#[derive(Clone)]
77
pub struct MqttPublishProtoHandler {
88
mqtt_client: AsyncClient,
9-
/// application_name is used for the hardcoded queue name and for debugging purposes
9+
/// `application_name` is used for the hardcoded queue name and for debugging purposes
1010
application_name: &'static str,
1111
}
1212

@@ -19,6 +19,7 @@ impl std::fmt::Debug for MqttPublishProtoHandler {
1919
}
2020

2121
impl MqttPublishProtoHandler {
22+
#[must_use]
2223
pub fn new(application_name: &'static str, mqtt_client: AsyncClient) -> Self {
2324
MqttPublishProtoHandler {
2425
mqtt_client,

shared-deps/src/protocols/mqtt/subscribe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
pub struct MqttSubscribeProtoHandler {
1414
mqtt_client: AsyncClient,
1515
mqtt_event_loop: EventLoop,
16-
/// application_name is used for the hardcoded queue name and for debugging purposes
16+
/// `application_name` is used for the hardcoded queue name and for debugging purposes
1717
application_name: &'static str,
1818
}
1919

@@ -108,7 +108,7 @@ async fn broker_consumer_loop_inner(
108108
break false;
109109
},
110110
() = &mut retry_wait => {
111-
continue;
111+
// no-op
112112
},
113113
}
114114
},

shared-deps/src/protocols/mqtt/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pub(crate) async fn subscribe_all(mqtt_client: &AsyncClient) -> Result<(), Strin
1111
///
1212
/// this should generally happen at some point in the subscribe loop
1313
pub(crate) fn mqtt_topic_to_proxy_topic(topic: &str) -> String {
14-
topic.replace("/", ".")
14+
topic.replace('/', ".")
1515
}

0 commit comments

Comments
 (0)