Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #1180]Fix cargo clippy -- -D warnings error #1181

Merged
merged 3 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rocketmq-broker/src/processor/pull_message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ pub(crate) fn is_broadcast(
consumer_group_info: Option<&ConsumerGroupInfo>,
) -> bool {
proxy_pull_broadcast
|| consumer_group_info.map_or(false, |info| {
|| consumer_group_info.is_some_and(|info| {
matches!(info.get_message_model(), MessageModel::Broadcasting)
&& matches!(info.get_consume_type(), ConsumeType::ConsumePassively)
})
Expand Down
5 changes: 2 additions & 3 deletions rocketmq-broker/src/processor/send_message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,8 @@
message_ext.properties_string = MessageDecoder::message_properties_to_string(
&message_ext.message_ext_inner.message.properties,
);
let tra_flag = tra_flag.map_or(false, |tra_flag_inner| {
tra_flag_inner.parse().unwrap_or(false)
});
let tra_flag =
tra_flag.is_some_and(|tra_flag_inner| tra_flag_inner.parse().unwrap_or(false));

Check warning on line 519 in rocketmq-broker/src/processor/send_message_processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/processor/send_message_processor.rs#L518-L519

Added lines #L518 - L519 were not covered by tests

let send_transaction_prepare_message =
if tra_flag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
.get_property(&CheetahString::from_static_str(
MessageConst::PROPERTY_TRANSACTION_PREPARED,
))
.map_or(false, |v| v.parse().unwrap_or(false));
.is_some_and(|v| v.parse().unwrap_or(false));

Check warning on line 175 in rocketmq-client/src/consumer/consumer_impl/pull_api_wrapper.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-client/src/consumer/consumer_impl/pull_api_wrapper.rs#L175

Added line #L175 was not covered by tests
if tra_flag {
if let Some(transaction_id) = msg.get_property(&CheetahString::from_static_str(
MessageConst::PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX,
Expand Down
2 changes: 1 addition & 1 deletion rocketmq-client/src/implementation/mq_client_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@
.ext_fields()
.unwrap()
.get(MessageConst::PROPERTY_TRACE_SWITCH)
.map_or(false, |s| s.parse().unwrap_or(false));
.is_some_and(|s| s.parse().unwrap_or(false));

Check warning on line 574 in rocketmq-client/src/implementation/mq_client_api_impl.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-client/src/implementation/mq_client_api_impl.rs#L574

Added line #L574 was not covered by tests
let send_result = SendResult {
send_status,
msg_id: uniq_msg_id,
Expand Down
6 changes: 3 additions & 3 deletions rocketmq-common/src/utils/string_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
impl StringUtils {
#[inline]
pub fn is_not_empty_str(s: Option<&str>) -> bool {
s.map_or(false, |s| !s.is_empty())
s.is_some_and(|s| !s.is_empty())
}

#[inline]
pub fn is_not_empty_string(s: Option<&String>) -> bool {
s.map_or(false, |s| !s.is_empty())
s.is_some_and(|s| !s.is_empty())
}

#[inline]
pub fn is_not_empty_ch_string(s: Option<&CheetahString>) -> bool {
s.map_or(false, |s| !s.is_empty())
s.is_some_and(|s| !s.is_empty())

Check warning on line 34 in rocketmq-common/src/utils/string_utils.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-common/src/utils/string_utils.rs#L34

Added line #L34 was not covered by tests
}
}

Expand Down
2 changes: 1 addition & 1 deletion rocketmq-namesrv/src/route/route_info_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@
if self
.broker_addr_table
.get(broker_name)
.map_or(false, |b| b.enable_acting_master())
.is_some_and(|b| b.enable_acting_master())

Check warning on line 1050 in rocketmq-namesrv/src/route/route_info_manager.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/route/route_info_manager.rs#L1050

Added line #L1050 was not covered by tests
{
// Master has been unregistered, wipe the write perm
let flag = {
Expand Down
2 changes: 1 addition & 1 deletion rocketmq-store/src/log_file/commit_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@
pub fn is_multi_dispatch_msg(msg_inner: &MessageExtBrokerInner) -> bool {
msg_inner
.property(MessageConst::PROPERTY_INNER_MULTI_DISPATCH)
.map_or(false, |s| !s.is_empty())
.is_some_and(|s| !s.is_empty())

Check warning on line 796 in rocketmq-store/src/log_file/commit_log.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-store/src/log_file/commit_log.rs#L796

Added line #L796 was not covered by tests
&& msg_inner
.topic()
.starts_with(mix_all::RETRY_GROUP_TOPIC_PREFIX)
Expand Down
Loading