Small improvements (#27)
* Return error instead of panicking if reader buffer is inadequate * Simplify loop * Remove unnecessary mut * Simplify increment * Improve variable name * Simplify loop * Simplify loops * Improve documentation and simplify loop
This commit is contained in:
committed by
GitHub
parent
74f6e49507
commit
e94672fd96
@@ -66,7 +66,7 @@ async fn publish_core<'b>(
|
||||
qos: QualityOfService,
|
||||
topic: &str,
|
||||
message: &str,
|
||||
err: bool,
|
||||
should_err: bool,
|
||||
) -> Result<(), ReasonCode> {
|
||||
info!(
|
||||
"[Publisher] Connection to broker with username {} and password {}",
|
||||
@@ -85,7 +85,7 @@ async fn publish_core<'b>(
|
||||
.send_message(topic, message.as_bytes(), qos, false)
|
||||
.await;
|
||||
info!("[PUBLISHER] sent");
|
||||
if err == true {
|
||||
if should_err {
|
||||
assert_err!(result);
|
||||
} else {
|
||||
assert_ok!(result);
|
||||
|
||||
@@ -83,7 +83,7 @@ async fn publish_core<'b>(
|
||||
.await;
|
||||
info!("[PUBLISHER] sent {}", count);
|
||||
assert_ok!(result);
|
||||
count = count + 1;
|
||||
count += 1;
|
||||
if count == amount {
|
||||
break;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ async fn receive_core<'b>(
|
||||
let act_message = String::from_utf8_lossy(msg?.1);
|
||||
info!("[Receiver] Got new {}. message: {}", count, act_message);
|
||||
assert_eq!(act_message, MSG);
|
||||
count = count + 1;
|
||||
count += 1;
|
||||
if count == amount {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user