Skip to content

Commit

Permalink
Merge pull request #3321 from rina23q/fix/clippy-warning-unnecessary-…
Browse files Browse the repository at this point in the history
…unwrap-or

refactor: clippy warning unnecessary_map_or
  • Loading branch information
rina23q authored Jan 9, 2025
2 parents bd06fcb + c4a164b commit 90de4ae
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl FieldOrGroup {
pub fn is_called(&self, target: &syn::Ident) -> bool {
self.ident() == target
|| match self {
Self::Field(field) => field.rename().map_or(false, |rename| *target == rename),
Self::Field(field) => field.rename().is_some_and(|rename| *target == rename),
// Groups don't support renaming at the moment
Self::Group(_) => false,
Self::Multi(_) => false,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/tedge/src/cli/connect/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ fn bridge_health_topic(

fn is_bridge_health_up_message(message: &rumqttc::Publish, health_topic: &str) -> bool {
message.topic == health_topic
&& std::str::from_utf8(&message.payload).map_or(false, |msg| msg.contains("\"up\""))
&& std::str::from_utf8(&message.payload).is_ok_and(|msg| msg.contains("\"up\""))
}

// Check the connection by using the jwt token retrieval over the mqtt.
Expand Down
2 changes: 1 addition & 1 deletion crates/core/tedge/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where

let is_known_subcommand = executable_name
.as_deref()
.map_or(false, |name| cmd.find_subcommand(name).is_some());
.is_some_and(|name| cmd.find_subcommand(name).is_some());
let cmd = cmd.multicall(is_known_subcommand);

let cmd2 = cmd.clone();
Expand Down
4 changes: 1 addition & 3 deletions crates/extensions/c8y_auth_proxy/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,7 @@ async fn respond_to(
let status = res.status();
let headers = std::mem::take(res.headers_mut());

let body = if te_header.map_or(false, |h| {
h.to_str().unwrap_or_default().contains("chunked")
}) {
let body = if te_header.is_some_and(|h| h.to_str().unwrap_or_default().contains("chunked")) {
axum::body::boxed(StreamBody::new(res.bytes_stream()))
} else {
axum::body::boxed(Full::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/extensions/tedge_mqtt_bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ impl<Ack: MqttAck, Clock: MonotonicClock> MessageLoopBreaker<Ack, Clock> {
if self
.forwarded_messages
.front()
.map_or(false, |(_, sent)| have_same_content(sent, &received))
.is_some_and(|(_, sent)| have_same_content(sent, &received))
{
self.client.ack(&received).await.unwrap();
self.forwarded_messages.pop_front();
Expand Down

0 comments on commit 90de4ae

Please sign in to comment.