Skip to content

Commit

Permalink
style(kafka sink): Use string interpolation in error string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
belltoy committed Aug 22, 2024
1 parent 9deea84 commit df464ab
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/sinks/kafka/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ impl KafkaSinkConfig {
// Type: float
let key = "queue.buffering.max.ms";
if let Some(val) = self.librdkafka_options.get(key) {
return Err(format!("Batching setting `batch.timeout_secs` sets `librdkafka_options.{}={}`.\
The config already sets this as `librdkafka_options.queue.buffering.max.ms={}`.\
Please delete one.", key, value, val).into());
return Err(format!("Batching setting `batch.timeout_secs` sets `librdkafka_options.{key}={value}`.\
The config already sets this as `librdkafka_options.queue.buffering.max.ms={val}`.\
Please delete one.").into());
}
debug!(
librdkafka_option = key,
Expand All @@ -189,9 +189,9 @@ impl KafkaSinkConfig {
// Type: integer
let key = "batch.num.messages";
if let Some(val) = self.librdkafka_options.get(key) {
return Err(format!("Batching setting `batch.max_events` sets `librdkafka_options.{}={}`.\
The config already sets this as `librdkafka_options.batch.num.messages={}`.\
Please delete one.", key, value, val).into());
return Err(format!("Batching setting `batch.max_events` sets `librdkafka_options.{key}={value}`.\
The config already sets this as `librdkafka_options.batch.num.messages={val}`.\
Please delete one.").into());
}
debug!(
librdkafka_option = key,
Expand All @@ -210,9 +210,9 @@ impl KafkaSinkConfig {
// Type: integer
let key = "batch.size";
if let Some(val) = self.librdkafka_options.get(key) {
return Err(format!("Batching setting `batch.max_bytes` sets `librdkafka_options.{}={}`.\
The config already sets this as `librdkafka_options.batch.size={}`.\
Please delete one.", key, value, val).into());
return Err(format!("Batching setting `batch.max_bytes` sets `librdkafka_options.{key}={value}`.\
The config already sets this as `librdkafka_options.batch.size={val}`.\
Please delete one.").into());
}
debug!(
librdkafka_option = key,
Expand Down

0 comments on commit df464ab

Please sign in to comment.