Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mlowicki committed Jun 29, 2023
1 parent ab62d59 commit ab684c8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/producer/base_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,10 @@ unsafe extern "C" fn partitioner_cb<Part: Partitioner, C: ProducerContext<Part>>

let producer_context = &mut *(rkt_opaque as *mut C);

match producer_context.get_custom_partitioner() {
None => panic!("custom partitioner is not set"),
Some(partitioner) => {
partitioner.partition(topic_name, key, partition_cnt, is_partition_available)
}
}
producer_context
.get_custom_partitioner()
.expect("custom partitioner is not set")
.partition(topic_name, key, partition_cnt, is_partition_available)
}

impl FromClientConfig for BaseProducer<DefaultProducerContext> {
Expand All @@ -266,7 +264,7 @@ where
let native_config = config.create_native_config()?;
let context = Arc::new(context);

if let Some(_) = context.get_custom_partitioner() {
if context.get_custom_partitioner().is_some() {
let default_topic_config =
unsafe { rdsys::rd_kafka_conf_get_default_topic_conf(native_config.ptr()) };
unsafe {
Expand Down

0 comments on commit ab684c8

Please sign in to comment.