Skip to content

Commit ab684c8

Browse files
committed
review
1 parent ab62d59 commit ab684c8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/producer/base_producer.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,10 @@ unsafe extern "C" fn partitioner_cb<Part: Partitioner, C: ProducerContext<Part>>
234234

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

237-
match producer_context.get_custom_partitioner() {
238-
None => panic!("custom partitioner is not set"),
239-
Some(partitioner) => {
240-
partitioner.partition(topic_name, key, partition_cnt, is_partition_available)
241-
}
242-
}
237+
producer_context
238+
.get_custom_partitioner()
239+
.expect("custom partitioner is not set")
240+
.partition(topic_name, key, partition_cnt, is_partition_available)
243241
}
244242

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

269-
if let Some(_) = context.get_custom_partitioner() {
267+
if context.get_custom_partitioner().is_some() {
270268
let default_topic_config =
271269
unsafe { rdsys::rd_kafka_conf_get_default_topic_conf(native_config.ptr()) };
272270
unsafe {

0 commit comments

Comments
 (0)