Skip to content

Commit

Permalink
Fix Rust 1.84 clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Jan 10, 2025
1 parent 5764ab5 commit 507cf90
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion commons/zenoh-keyexpr/src/key_expr/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl<'s, Storage: IKeFormatStorage<'s>> core::fmt::Debug for KeFormatter<'s, Sto
let sharp = if id.contains('}')
|| pattern.contains('}')
|| value.map_or_else(
|| spec.default().map_or(false, |v| v.contains('}')),
|| spec.default().is_some_and(|v| v.contains('}')),
|v| v.contains('}'),
) {
"#"
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-keyexpr/src/key_expr/format/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fn do_parse<'a>(
}
}
pattern.is_double_wild()
&& prefix.map_or(false, |prefix| prefix.intersects(target))
&& prefix.is_some_and(|prefix| prefix.intersects(target))
&& do_parse(None, segments, results)
}
_ => unreachable!(),
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-protocol/src/core/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl EndPoint {
let m: &str = metadata.as_ref();
let c: &str = config.as_ref();

let len = p.as_bytes().len() + a.as_bytes().len() + m.as_bytes().len();
let len = p.len() + a.len() + m.len();
if len > u8::MAX as usize {
bail!("Endpoint too big: {} bytes. Max: {} bytes. ", len, u8::MAX);
}
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1916,13 +1916,13 @@ impl SessionInner {
MatchingStatusType::Queryables(false) => state.queryables.values().any(|q| {
state
.local_wireexpr_to_expr(&q.key_expr)
.map_or(false, |ke| ke.intersects(key_expr))
.is_ok_and(|ke| ke.intersects(key_expr))
}),
MatchingStatusType::Queryables(true) => state.queryables.values().any(|q| {
q.complete
&& state
.local_wireexpr_to_expr(&q.key_expr)
.map_or(false, |ke| ke.includes(key_expr))
.is_ok_and(|ke| ke.includes(key_expr))
}),
};
MatchingStatus { matching }
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/net/routing/hat/client/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl HatQueriesTrait for HatCode {
qbl.session_ctxs
.get(&face.id)
.and_then(|sc| sc.qabl)
.map_or(false, |q| q.complete)
.is_some_and(|q| q.complete)
&& KeyExpr::keyexpr_include(qbl.expr(), key_expr)
}
false => KeyExpr::keyexpr_intersect(qbl.expr(), key_expr),
Expand All @@ -493,7 +493,7 @@ impl HatQueriesTrait for HatCode {
for (sid, context) in &mres.session_ctxs {
if context.face.whatami == WhatAmI::Client
&& match complete {
true => context.qabl.map_or(false, |q| q.complete),
true => context.qabl.is_some_and(|q| q.complete),
false => context.qabl.is_some(),
}
{
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/linkstate_peer/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ impl HatQueriesTrait for HatCode {

for (sid, context) in &mres.session_ctxs {
if match complete {
true => context.qabl.map_or(false, |q| q.complete),
true => context.qabl.is_some_and(|q| q.complete),
false => context.qabl.is_some(),
} {
matching_queryables
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/p2p_peer/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl HatQueriesTrait for HatCode {
}
for (sid, context) in &mres.session_ctxs {
if match complete {
true => context.qabl.map_or(false, |q| q.complete),
true => context.qabl.is_some_and(|q| q.complete),
false => context.qabl.is_some(),
} {
matching_queryables
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/router/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ impl HatQueriesTrait for HatCode {
if master {
for (sid, context) in &mres.session_ctxs {
if match complete {
true => context.qabl.map_or(false, |q| q.complete),
true => context.qabl.is_some_and(|q| q.complete),
false => context.qabl.is_some(),
} && context.face.whatami != WhatAmI::Router
{
Expand Down

0 comments on commit 507cf90

Please sign in to comment.