diff --git a/influxdb3/src/commands/create.rs b/influxdb3/src/commands/create.rs index c3fecdfeaf1..7549e8c392b 100644 --- a/influxdb3/src/commands/create.rs +++ b/influxdb3/src/commands/create.rs @@ -400,7 +400,7 @@ pub async fn command(config: Config) -> Result<(), Box> { let json = json!({"token": response.token, "help_msg": help_msg}); let stringified = serde_json::to_string_pretty(&json) .expect("token details to be parseable"); - println!("{}", stringified); + println!("{stringified}"); } token::TokenOutputFormat::Text => { let token = response.token; @@ -419,7 +419,7 @@ pub async fn command(config: Config) -> Result<(), Box> { } }, Err(err) => { - println!("Failed to create token, error: {:?}", err); + println!("Failed to create token, error: {err:?}"); } } } @@ -458,10 +458,10 @@ pub async fn command(config: Config) -> Result<(), Box> { .await { Err(e) => { - eprintln!("Failed to create trigger: {}", e); + eprintln!("Failed to create trigger: {e}"); return Err(e.into()); } - Ok(_) => println!("Trigger {} created successfully", trigger_name), + Ok(_) => println!("Trigger {trigger_name} created successfully"), } } } diff --git a/influxdb3/src/commands/delete.rs b/influxdb3/src/commands/delete.rs index 918bc7d1d79..f90b38feb2a 100644 --- a/influxdb3/src/commands/delete.rs +++ b/influxdb3/src/commands/delete.rs @@ -242,10 +242,7 @@ pub async fn command(config: Config) -> Result<(), Box> { hard_delete, .. }) => { - println!( - "Are you sure you want to delete {:?}? Enter 'yes' to confirm", - database_name - ); + println!("Are you sure you want to delete {database_name:?}? Enter 'yes' to confirm"); let mut confirmation = String::new(); let _ = io::stdin().read_line(&mut confirmation); if confirmation.trim() != "yes" { @@ -341,7 +338,7 @@ pub async fn command(config: Config) -> Result<(), Box> { force, ) .await?; - println!("Trigger {} deleted successfully", trigger_name); + println!("Trigger {trigger_name} deleted successfully"); } SubCommand::Token(TokenConfig { token_name, .. }) => { if token_name == "_admin" { @@ -351,17 +348,14 @@ pub async fn command(config: Config) -> Result<(), Box> { return Ok(()); } - println!( - "Are you sure you want to delete {:?}? Enter 'yes' to confirm", - token_name - ); + println!("Are you sure you want to delete {token_name:?}? Enter 'yes' to confirm"); let mut confirmation = String::new(); let _ = io::stdin().read_line(&mut confirmation); if confirmation.trim() != "yes" { println!("Cannot delete token without confirmation"); } else { client.api_v3_configure_token_delete(&token_name).await?; - println!("Token {:?} deleted successfully", &token_name); + println!("Token {token_name:?} deleted successfully"); } } } diff --git a/influxdb3/src/commands/disable.rs b/influxdb3/src/commands/disable.rs index 696ffea9e83..85a1357868b 100644 --- a/influxdb3/src/commands/disable.rs +++ b/influxdb3/src/commands/disable.rs @@ -62,7 +62,7 @@ pub async fn command(config: Config) -> Result<(), Box> { client .api_v3_configure_processing_engine_trigger_disable(database_name, &trigger_name) .await?; - println!("Trigger {} disabled successfully", trigger_name); + println!("Trigger {trigger_name} disabled successfully"); } } Ok(()) diff --git a/influxdb3/src/commands/enable.rs b/influxdb3/src/commands/enable.rs index 27cb37a86fa..a5ad4c91219 100644 --- a/influxdb3/src/commands/enable.rs +++ b/influxdb3/src/commands/enable.rs @@ -62,7 +62,7 @@ pub async fn command(config: Config) -> Result<(), Box> { client .api_v3_configure_processing_engine_trigger_enable(database_name, &trigger_name) .await?; - println!("Trigger {} enabled successfully", trigger_name); + println!("Trigger {trigger_name} enabled successfully"); } } Ok(()) diff --git a/influxdb3/src/commands/plugin_test/wal.rs b/influxdb3/src/commands/plugin_test/wal.rs index 1d817ad9d48..0a97077714d 100644 --- a/influxdb3/src/commands/plugin_test/wal.rs +++ b/influxdb3/src/commands/plugin_test/wal.rs @@ -65,7 +65,7 @@ pub(super) async fn command(config: Config) -> Result<(), Box> { .expect("serialize wal plugin test response as JSON"); // pretty print the response - println!("{}", res); + println!("{res}"); Ok(()) } diff --git a/influxdb3/src/commands/serve.rs b/influxdb3/src/commands/serve.rs index a53182bb037..1fdffdcfc8e 100644 --- a/influxdb3/src/commands/serve.rs +++ b/influxdb3/src/commands/serve.rs @@ -1111,7 +1111,7 @@ async fn setup_telemetry_store( let influxdb_pkg_version = env!("CARGO_PKG_VERSION"); let influxdb_pkg_name = env!("CARGO_PKG_NAME"); // Following should show influxdb3-0.1.0 - let influx_version = format!("{}-{}", influxdb_pkg_name, influxdb_pkg_version); + let influx_version = format!("{influxdb_pkg_name}-{influxdb_pkg_version}"); let obj_store_type = object_store_config .object_store .unwrap_or(ObjectStoreType::Memory); diff --git a/influxdb3/src/commands/update.rs b/influxdb3/src/commands/update.rs index 91841381664..2ae7dfb956f 100644 --- a/influxdb3/src/commands/update.rs +++ b/influxdb3/src/commands/update.rs @@ -59,7 +59,7 @@ pub async fn command(config: Config) -> Result<(), Box> { .api_v3_configure_db_update(&database_name, retention) .await?; - println!("Database \"{}\" updated successfully", database_name); + println!("Database \"{database_name}\" updated successfully"); } else { return Err("--retention-period is required for update database".into()); } diff --git a/influxdb3/tests/cli/admin_token.rs b/influxdb3/tests/cli/admin_token.rs index d6d332e7af6..42d04313504 100644 --- a/influxdb3/tests/cli/admin_token.rs +++ b/influxdb3/tests/cli/admin_token.rs @@ -16,7 +16,7 @@ async fn test_create_admin_token() { let result = server .run(vec!["create", "token", "--admin"], args) .unwrap(); - println!("{:?}", result); + println!("{result:?}"); assert_contains!(&result, "New token created successfully!"); } diff --git a/influxdb3/tests/cli/api.rs b/influxdb3/tests/cli/api.rs index e0324e99f64..ba445fe77b1 100644 --- a/influxdb3/tests/cli/api.rs +++ b/influxdb3/tests/cli/api.rs @@ -176,7 +176,7 @@ impl CreateTableQuery<'_> { let fields_arg = self .fields .iter() - .map(|(name, dt)| format!("{}:{}", name, dt)) + .map(|(name, dt)| format!("{name}:{dt}")) .collect::>() .join(","); diff --git a/influxdb3/tests/cli/db_retention.rs b/influxdb3/tests/cli/db_retention.rs index 7e6fa82642c..5c22328c709 100644 --- a/influxdb3/tests/cli/db_retention.rs +++ b/influxdb3/tests/cli/db_retention.rs @@ -121,7 +121,7 @@ async fn test_update_db_retention_period() { assert_contains!( &result, - format!("Database \"{}\" created successfully", db_name) + format!("Database \"{db_name}\" created successfully") ); // Update database retention period @@ -141,7 +141,7 @@ async fn test_update_db_retention_period() { assert_contains!( &result, - format!("Database \"{}\" updated successfully", db_name) + format!("Database \"{db_name}\" updated successfully") ); // Verify the updated retention period @@ -158,7 +158,7 @@ async fn test_update_db_retention_period() { "query", "-d", "_internal", - &format!("SELECT retention_period_ns FROM system.databases WHERE system.databases.database_name='{}'", db_name), + &format!("SELECT retention_period_ns FROM system.databases WHERE system.databases.database_name='{db_name}'"), ], args, ) @@ -183,7 +183,7 @@ async fn test_clear_db_retention_period() { assert_contains!( &result, - format!("Database \"{}\" created successfully", db_name) + format!("Database \"{db_name}\" created successfully") ); // Clear database retention period (set to none) @@ -203,7 +203,7 @@ async fn test_clear_db_retention_period() { assert_contains!( &result, - format!("Database \"{}\" updated successfully", db_name) + format!("Database \"{db_name}\" updated successfully") ); // Verify the retention period is now none (cleared) @@ -220,7 +220,7 @@ async fn test_clear_db_retention_period() { "query", "-d", "_internal", - &format!("SELECT retention_period_ns FROM system.databases WHERE system.databases.database_name='{}'", db_name), + &format!("SELECT retention_period_ns FROM system.databases WHERE system.databases.database_name='{db_name}'"), ], args, ) diff --git a/influxdb3/tests/cli/mod.rs b/influxdb3/tests/cli/mod.rs index b1a4db4e38f..aacf874cab3 100644 --- a/influxdb3/tests/cli/mod.rs +++ b/influxdb3/tests/cli/mod.rs @@ -50,7 +50,7 @@ fn write_plugin_to_temp_dir(temp_dir: &TempDir, name: &str, code: &str) -> PathB // Write the code to the file let mut file = File::create(&file_path).unwrap(); - writeln!(file, "{}", code).unwrap(); + writeln!(file, "{code}").unwrap(); file_path } @@ -628,16 +628,13 @@ async fn test_create_trigger_and_run() { } check_count += 1; if check_count > 10 { - panic!( - "Unexpected query result, got: {:#?}, expected {:#?}", - value, expected - ); + panic!("Unexpected query result, got: {value:#?}, expected {expected:#?}"); } } Err(e) => { check_count += 1; if check_count > 10 { - panic!("Failed to query processed data: {}", e); + panic!("Failed to query processed data: {e}"); } tokio::time::sleep(tokio::time::Duration::from_millis(10)).await; } @@ -722,16 +719,13 @@ async fn test_triggers_are_started() { } check_count += 1; if check_count > 10 { - panic!( - "Unexpected query result, got: {:#?}, expected {:#?}", - value, expected - ); + panic!("Unexpected query result, got: {value:#?}, expected {expected:#?}"); } } Err(e) => { check_count += 1; if check_count > 10 { - panic!("Failed to query processed data: {}", e); + panic!("Failed to query processed data: {e}"); } tokio::time::sleep(tokio::time::Duration::from_millis(10)).await; } @@ -894,7 +888,7 @@ def process_writes(influxdb3_local, table_batches, args=None): db_name, trigger_name, plugin_filename, - format!("table:{}", table_name), + format!("table:{table_name}"), ) .run() .unwrap(); @@ -2165,9 +2159,7 @@ async fn test_trigger_create_validates_file_present() { fn check_logs(response: &Value, expected_logs: &[&str]) { assert!( response["errors"].as_array().unwrap().is_empty(), - "Unexpected errors in response {:#?}, expected logs {:#?}", - response, - expected_logs + "Unexpected errors in response {response:#?}, expected logs {expected_logs:#?}" ); let logs = response["log_lines"].as_array().unwrap(); assert_eq!( diff --git a/influxdb3/tests/server/limits.rs b/influxdb3/tests/server/limits.rs index 9bdde44a500..50add69d521 100644 --- a/influxdb3/tests/server/limits.rs +++ b/influxdb3/tests/server/limits.rs @@ -59,7 +59,7 @@ async fn limits() -> Result<(), Error> { let mut lp_500 = String::from("cpu,host=foo,region=bar usage=2"); let mut lp_501 = String::from("cpu,host=foo,region=bar usage=2"); for i in 5..=500 { - let column = format!(",column{}=1", i); + let column = format!(",column{i}=1"); lp_500.push_str(&column); lp_501.push_str(&column); } diff --git a/influxdb3/tests/server/packages.rs b/influxdb3/tests/server/packages.rs index 03e5f1b1fc3..febf7b1b659 100644 --- a/influxdb3/tests/server/packages.rs +++ b/influxdb3/tests/server/packages.rs @@ -108,7 +108,7 @@ async fn test_python_venv_pip_install() -> Result<()> { // Install specific version server .install_package() - .add_package(format!("{}=={}", TEST_PACKAGE, TEST_VERSION)) + .add_package(format!("{TEST_PACKAGE}=={TEST_VERSION}")) .run()?; // Verify correct version installed @@ -169,7 +169,7 @@ async fn test_venv_requirements_install() -> Result<()> { // Create requirements.txt let mut requirements_file = NamedTempFile::new()?; - writeln!(requirements_file, "{}=={}", TEST_PACKAGE, TEST_VERSION)?; + writeln!(requirements_file, "{TEST_PACKAGE}=={TEST_VERSION}")?; // Install from requirements server @@ -238,7 +238,7 @@ async fn test_auto_venv_pip_install() -> Result<()> { // Install specific version server .install_package() - .add_package(format!("{}=={}", TEST_PACKAGE, TEST_VERSION)) + .add_package(format!("{TEST_PACKAGE}=={TEST_VERSION}")) .with_package_manager("pip") .run()?; diff --git a/influxdb3_catalog/src/catalog.rs b/influxdb3_catalog/src/catalog.rs index 1f2b1fbabb2..2ce56fdd2d8 100644 --- a/influxdb3_catalog/src/catalog.rs +++ b/influxdb3_catalog/src/catalog.rs @@ -4524,7 +4524,7 @@ mod tests { let table_ids = vec![TableId::from(1), TableId::from(2), TableId::from(3)]; for (i, table_id) in table_ids.iter().enumerate() { - let table_name = Arc::from(format!("table_{}", i)); + let table_name = Arc::from(format!("table_{i}")); let table_def = TableDefinition::new_empty(*table_id, table_name); db_schema .tables @@ -4902,7 +4902,7 @@ mod tests { assert!(duration >= Duration::from_secs(3599)); assert!(duration <= Duration::from_secs(3601)); } - other => panic!("Expected Hard deletion status, got {:?}", other), + other => panic!("Expected Hard deletion status, got {other:?}"), } } @@ -4948,7 +4948,7 @@ mod tests { assert!(duration >= Duration::from_secs(599)); assert!(duration <= Duration::from_secs(601)); } - other => panic!("Expected Hard deletion status, got {:?}", other), + other => panic!("Expected Hard deletion status, got {other:?}"), } } @@ -5092,7 +5092,7 @@ mod tests { assert!(duration >= Duration::from_secs(3599)); assert!(duration <= Duration::from_secs(3601)); } - other => panic!("Expected Hard deletion status, got {:?}", other), + other => panic!("Expected Hard deletion status, got {other:?}"), } } @@ -5159,7 +5159,7 @@ mod tests { assert!(duration >= Duration::from_secs(599)); assert!(duration <= Duration::from_secs(601)); } - other => panic!("Expected Hard deletion status, got {:?}", other), + other => panic!("Expected Hard deletion status, got {other:?}"), } } @@ -5263,7 +5263,7 @@ mod tests { assert!(duration >= Duration::from_secs(1799)); assert!(duration <= Duration::from_secs(1801)); } - other => panic!("Expected Hard deletion status for table3, got {:?}", other), + other => panic!("Expected Hard deletion status for table3, got {other:?}"), } } } diff --git a/influxdb3_catalog/src/log/versions/v2.rs b/influxdb3_catalog/src/log/versions/v2.rs index 27075890f65..2ebcc09d4bd 100644 --- a/influxdb3_catalog/src/log/versions/v2.rs +++ b/influxdb3_catalog/src/log/versions/v2.rs @@ -807,17 +807,17 @@ impl TriggerSpecificationDefinition { pub fn string_rep(&self) -> String { match self { TriggerSpecificationDefinition::SingleTableWalWrite { table_name } => { - format!("table:{}", table_name) + format!("table:{table_name}") } TriggerSpecificationDefinition::AllTablesWalWrite => "all_tables".to_string(), TriggerSpecificationDefinition::Schedule { schedule } => { - format!("cron:{}", schedule) + format!("cron:{schedule}") } TriggerSpecificationDefinition::Every { duration } => { format!("every:{}", format_duration(*duration)) } TriggerSpecificationDefinition::RequestPath { path } => { - format!("request:{}", path) + format!("request:{path}") } } } diff --git a/influxdb3_catalog/src/log/versions/v3.rs b/influxdb3_catalog/src/log/versions/v3.rs index baa61872a63..8c3869b79c8 100644 --- a/influxdb3_catalog/src/log/versions/v3.rs +++ b/influxdb3_catalog/src/log/versions/v3.rs @@ -886,17 +886,17 @@ impl TriggerSpecificationDefinition { pub fn string_rep(&self) -> String { match self { TriggerSpecificationDefinition::SingleTableWalWrite { table_name } => { - format!("table:{}", table_name) + format!("table:{table_name}") } TriggerSpecificationDefinition::AllTablesWalWrite => "all_tables".to_string(), TriggerSpecificationDefinition::Schedule { schedule } => { - format!("cron:{}", schedule) + format!("cron:{schedule}") } TriggerSpecificationDefinition::Every { duration } => { format!("every:{}", format_duration(*duration)) } TriggerSpecificationDefinition::RequestPath { path } => { - format!("request:{}", path) + format!("request:{path}") } } } diff --git a/influxdb3_load_generator/src/commands/write.rs b/influxdb3_load_generator/src/commands/write.rs index 4fc4ae59fec..7946e917a32 100644 --- a/influxdb3_load_generator/src/commands/write.rs +++ b/influxdb3_load_generator/src/commands/write.rs @@ -153,10 +153,7 @@ pub(crate) async fn run_write_load( .. } = config; - println!( - "creating generators for {} concurrent writers", - writer_count - ); + println!("creating generators for {writer_count} concurrent writers"); println!("each writer will send a write request every {sampling_interval}"); let mut generators = @@ -177,9 +174,8 @@ pub(crate) async fn run_write_load( let start_time = if let Some(start_time) = start_time { let start_time = parse_time_offset(&start_time, Local::now()); println!( - "starting writers from a start time of {:?}. Historical replay will happen as \ - fast as possible until catching up to now or hitting the end time.", - start_time + "starting writers from a start time of {start_time:?}. Historical replay will happen as \ + fast as possible until catching up to now or hitting the end time." ); Some(start_time) } else { diff --git a/influxdb3_load_generator/src/commands/write_fixed.rs b/influxdb3_load_generator/src/commands/write_fixed.rs index f5a4f0700a9..801a759604d 100644 --- a/influxdb3_load_generator/src/commands/write_fixed.rs +++ b/influxdb3_load_generator/src/commands/write_fixed.rs @@ -86,8 +86,7 @@ fn generate_data_points(expected_tput_in_mb: f64, num_writers: usize) -> (Vec (Vec tput_bytes { @@ -174,13 +172,13 @@ pub async fn command(config: WriteFixedConfig) -> Result<(), Infallible> { let mut all_dbs = vec![]; for i in 1..=config.write.num_databases { - all_dbs.push(format!("foo_{}", i)); + all_dbs.push(format!("foo_{i}")); } let mut db_iter = CustomDbIter { iter: all_dbs.iter().cycle(), }; let write_uri = format!("{}api/v3/write_lp", config.host_url); - println!("writing to {}", write_uri); + println!("writing to {write_uri}"); loop { let mut futs = vec![]; diff --git a/influxdb3_load_generator/src/line_protocol_generator.rs b/influxdb3_load_generator/src/line_protocol_generator.rs index 11bd74ac31a..ea9f09ecafe 100644 --- a/influxdb3_load_generator/src/line_protocol_generator.rs +++ b/influxdb3_load_generator/src/line_protocol_generator.rs @@ -318,12 +318,12 @@ impl Generator { for (i, field) in measurement.fields.iter_mut().enumerate() { let separator = if i == 0 { " " } else { "," }; - write!(w, "{}", separator)?; + write!(w, "{separator}")?; field.write_to(&mut w, rng)?; } write_summary.fields_written += measurement.fields.len(); - writeln!(w, " {}", timestamp)?; + writeln!(w, " {timestamp}")?; write_summary.lines_written += 1; } @@ -383,12 +383,12 @@ impl Tag { } if let Some(v) = &self.value { - write!(w, "{}", v)?; + write!(w, "{v}")?; } // append the writer id with a preceding w if we're supposed to if self.append_writer_id { - write!(w, "{}", writer_id)?; + write!(w, "{writer_id}")?; } // append the copy id with a preceding c if we're supposed to @@ -458,29 +458,29 @@ impl Field { match &mut self.field_value { FieldValue::Integer(f) => match f { - IntegerValue::Fixed(v) => write!(w, "{}i", v)?, + IntegerValue::Fixed(v) => write!(w, "{v}i")?, IntegerValue::Random(range) => { let v: i64 = rng.gen_range(range.clone()); - write!(w, "{}i", v)?; + write!(w, "{v}i")?; } IntegerValue::Sequential(v) => { - write!(w, "{}u", v)?; + write!(w, "{v}u")?; *v += 1; } }, FieldValue::Float(f) => match f { - FloatValue::Fixed(v) => write!(w, "{}", v)?, + FloatValue::Fixed(v) => write!(w, "{v}")?, FloatValue::Random(range) => { let v: f64 = rng.gen_range(range.clone()); - write!(w, "{:.3}", v)?; + write!(w, "{v:.3}")?; } FloatValue::SequentialWithInc { next, inc } => { - write!(w, "{:.10}", next)?; + write!(w, "{next:.10}")?; *next += *inc; } }, FieldValue::String(s) => match s { - StringValue::Fixed(v) => write!(w, "\"{}\"", v)?, + StringValue::Fixed(v) => write!(w, "\"{v}\"")?, StringValue::Random(size) => { let random: String = rng .sample_iter(&Alphanumeric) @@ -488,17 +488,17 @@ impl Field { .map(char::from) .collect(); - write!(w, "\"{}\"", random)?; + write!(w, "\"{random}\"")?; } StringValue::Sequential(prefix, inc) => { - write!(w, "\"{}{}\"", prefix, inc)?; + write!(w, "\"{prefix}{inc}\"")?; *inc += 1; } }, FieldValue::Boolean(f) => match f { BooleanValue::Random => { let v: bool = rng.r#gen(); - write!(w, "{}", v)?; + write!(w, "{v}")?; } BooleanValue::Toggle(current) => { write!(w, "{current}")?; diff --git a/influxdb3_process/build.rs b/influxdb3_process/build.rs index c8df2281ca0..6873db6adf2 100644 --- a/influxdb3_process/build.rs +++ b/influxdb3_process/build.rs @@ -8,9 +8,11 @@ use std::process::Command; fn main() -> Result<(), Box> { println!("cargo:rerun-if-env-changed=GIT_HASH"); // Populate env!(GIT_HASH) with the current git commit - println!("cargo:rustc-env=GIT_HASH={}", get_git_hash()); + let git_hash = get_git_hash(); + println!("cargo:rustc-env=GIT_HASH={git_hash}"); // Populate env!(GIT_HASH_SHORT) with the current git commit - println!("cargo:rustc-env=GIT_HASH_SHORT={}", get_git_hash_short()); + let git_hash_short = get_git_hash_short(); + println!("cargo:rustc-env=GIT_HASH_SHORT={git_hash_short}"); let path = std::env::var("CARGO_MANIFEST_DIR").unwrap(); let meta = MetadataCommand::new() @@ -24,7 +26,7 @@ fn main() -> Result<(), Box> { .as_str() .unwrap_or("Core"); println!("cargo:rerun-if-env-changed=INFLUXDB3_BUILD_VERSION"); - println!("cargo:rustc-env=INFLUXDB3_BUILD_VERSION={}", build); + println!("cargo:rustc-env=INFLUXDB3_BUILD_VERSION={build}"); Ok(()) } diff --git a/influxdb3_processing_engine/src/lib.rs b/influxdb3_processing_engine/src/lib.rs index 6c273acc273..0152f0a817a 100644 --- a/influxdb3_processing_engine/src/lib.rs +++ b/influxdb3_processing_engine/src/lib.rs @@ -266,8 +266,7 @@ impl ProcessingEngineManagerImpl { if name.starts_with("gh:") { let plugin_path = name.strip_prefix("gh:").unwrap(); let url = format!( - "https://raw.githubusercontent.com/influxdata/influxdb3_plugins/main/{}", - plugin_path + "https://raw.githubusercontent.com/influxdata/influxdb3_plugins/main/{plugin_path}" ); let resp = reqwest::get(&url) .await @@ -1032,7 +1031,7 @@ mod tests { def process_writes(influxdb3_local, table_batches, args=None): influxdb3_local.info("done") "#; - writeln!(file, "{}", code).unwrap(); + writeln!(file, "{code}").unwrap(); let environment_manager = ProcessingEngineEnvironmentManager { plugin_dir: Some(file.path().parent().unwrap().to_path_buf()), virtual_env_location: None, diff --git a/influxdb3_processing_engine/src/plugins.rs b/influxdb3_processing_engine/src/plugins.rs index 4b98e8c8186..6519713302e 100644 --- a/influxdb3_processing_engine/src/plugins.rs +++ b/influxdb3_processing_engine/src/plugins.rs @@ -125,8 +125,7 @@ pub(crate) fn run_schedule_plugin( let plugin_type = trigger_definition.trigger.plugin_type(); if !matches!(plugin_type, influxdb3_catalog::log::PluginType::Schedule) { return Err(PluginError::NonSchedulePluginWithScheduleTrigger(format!( - "{:?}", - trigger_definition + "{trigger_definition:?}" ))); } @@ -288,7 +287,7 @@ mod python_plugin { match result { PluginNextState::SuccessfulRun => {} PluginNextState::LogError(error_log) => { - error!("trigger failed with error {}", error_log); + error!("trigger failed with error {error_log}"); self.logger.log(LogLevel::Error, error_log); }, PluginNextState::Disable(_) => { @@ -310,7 +309,7 @@ mod python_plugin { } } Err(err) => { - error!(?self.trigger_definition, "error processing wal contents: {}", err); + error!(?self.trigger_definition, "error processing wal contents: {err}"); } } } @@ -364,8 +363,8 @@ mod python_plugin { match plugin_state { PluginNextState::SuccessfulRun => {} PluginNextState::LogError(err) => { - self.logger.log(LogLevel::Error, format!("error running scheduled plugin: {}", err)); - error!(?self.trigger_definition, "error running scheduled plugin: {}", err); + self.logger.log(LogLevel::Error, format!("error running scheduled plugin: {err}")); + error!(?self.trigger_definition, "error running scheduled plugin: {err}"); } PluginNextState::Disable(trigger_definition) => { warn!("disabling trigger {} due to error", trigger_definition.trigger_name); @@ -383,7 +382,7 @@ mod python_plugin { } } Err(err) => { - self.logger.log(LogLevel::Error, format!("error running scheduled plugin: {}", err)); + self.logger.log(LogLevel::Error, format!("error running scheduled plugin: {err}")); error!(?self.trigger_definition, "error running scheduled plugin: {}", err); } } @@ -405,15 +404,15 @@ mod python_plugin { Some(result) = futures.next() => { match result { Err(e) => { - self.logger.log(LogLevel::Error, format!("error running async scheduled plugin: {}", e)); - error!(?self.trigger_definition, "error running async scheduled plugin: {}", e); + self.logger.log(LogLevel::Error, format!("error running async scheduled plugin: {e}")); + error!(?self.trigger_definition, "error running async scheduled plugin: {e}"); } Ok(result) => { match result { PluginNextState::SuccessfulRun => {} PluginNextState::LogError(err) => { - self.logger.log(LogLevel::Error, format!("error running async scheduled plugin: {}", err)); - error!(?self.trigger_definition, "error running async scheduled plugin: {}", err); + self.logger.log(LogLevel::Error, format!("error running async scheduled plugin: {err}")); + error!(?self.trigger_definition, "error running async scheduled plugin: {err}"); } PluginNextState::Disable(trigger_definition) => { warn!("disabling trigger {} due to error", trigger_definition.trigger_name); @@ -496,9 +495,9 @@ mod python_plugin { for error in errors { self.logger.log( LogLevel::Error, - format!("error running request plugin: {}", error), + format!("error running request plugin: {error}"), ); - error!(?self.trigger_definition, "error running request plugin: {}", error); + error!(?self.trigger_definition, "error running request plugin: {error}"); } let response_status = StatusCode::from_u16(response_code) @@ -521,9 +520,9 @@ mod python_plugin { // build json string with the error with serde so that it is {"error": "error message"} self.logger.log( LogLevel::Error, - format!("error running request plugin: {}", e), + format!("error running request plugin: {e}"), ); - error!(?self.trigger_definition, "error running request plugin: {}", e); + error!(?self.trigger_definition, "error running request plugin: {e}"); let body = serde_json::json!({"error": e.to_string()}).to_string(); ResponseBuilder::new() .status(StatusCode::INTERNAL_SERVER_ERROR) @@ -629,9 +628,9 @@ mod python_plugin { for error in errors { self.logger.log( LogLevel::Error, - format!("error running wal plugin: {}", error), + format!("error running wal plugin: {error}"), ); - error!(?self.trigger_definition, "error running wal plugin: {}", error); + error!(?self.trigger_definition, "error running wal plugin: {error}"); } break; } @@ -640,9 +639,9 @@ mod python_plugin { ErrorBehavior::Log => { self.logger.log( LogLevel::Error, - format!("error executing against batch {}", err), + format!("error executing against batch {err}"), ); - error!(?self.trigger_definition, "error running against batch: {}", err); + error!(?self.trigger_definition, "error running against batch: {err}"); } ErrorBehavior::Retry => { info!( @@ -688,13 +687,13 @@ mod python_plugin { ) .await { - errors.push(format!("error writing back lines: {}", e)); + errors.push(format!("error writing back lines: {e}")); } } for (db_name, lines) in plugin_return_state.write_db_lines { let Ok(namespace_name) = NamespaceName::new(db_name.clone()) else { - errors.push(format!("invalid database name: {}", db_name)); + errors.push(format!("invalid database name: {db_name}")); continue; }; @@ -710,7 +709,7 @@ mod python_plugin { ) .await { - errors.push(format!("error writing back lines to {}: {}", db_name, e)); + errors.push(format!("error writing back lines to {db_name}: {e}")); } } @@ -826,7 +825,7 @@ mod python_plugin { let errors = plugin.handle_return_state(result).await; // TODO: here is one spot we'll pick up errors to put into the plugin system table for error in errors { - error!(?plugin.trigger_definition, "error running schedule plugin: {}", error); + error!(?plugin.trigger_definition, "error running schedule plugin: {error}"); } return Ok(PluginNextState::SuccessfulRun); } @@ -947,8 +946,7 @@ impl TestWriteHandler { Ok(v) => v, Err(e) => { errors.push(format!( - "Failed to initialize validator for db {}: {}", - db_name, e + "Failed to initialize validator for db {db_name}: {e}" )); return errors; } @@ -965,19 +963,17 @@ impl TestWriteHandler { let data = data.ignore_catalog_changes_and_convert_lines_to_buffer(Gen1Duration::new_1m()); for err in data.errors { - errors.push(format!("{:?}", err)); + errors.push(format!("{err:?}")); } } Err(write_buffer::Error::ParseError(e)) => { errors.push(format!( - "line protocol parse error on write to db {}: {:?}", - db_name, e + "line protocol parse error on write to db {db_name}: {e:?}" )); } Err(e) => { errors.push(format!( - "Failed to validate output lines to db {}: {}", - db_name, e + "Failed to validate output lines to db {db_name}: {e}" )); } } @@ -990,7 +986,7 @@ impl TestWriteHandler { let namespace = match NamespaceName::new(db_name.to_string()) { Ok(namespace) => namespace, Err(e) => { - all_errors.push(format!("database name {} is invalid: {}", db_name, e)); + all_errors.push(format!("database name {db_name} is invalid: {e}")); continue; } }; diff --git a/influxdb3_processing_engine/src/virtualenv.rs b/influxdb3_processing_engine/src/virtualenv.rs index 75e5a1ca6a4..e18a1c573f7 100644 --- a/influxdb3_processing_engine/src/virtualenv.rs +++ b/influxdb3_processing_engine/src/virtualenv.rs @@ -187,7 +187,7 @@ pub fn init_pyo3() { } else { venv_dir .join("lib") - .join(format!("python{}.{}", major, minor)) + .join(format!("python{major}.{minor}")) .join("site-packages") }; @@ -217,7 +217,7 @@ pub fn init_pyo3() { } else { match orig_pyhome_env { Some(v) => { - debug!("Restoring previous PYTHONHOME to: {}", v); + debug!("Restoring previous PYTHONHOME to: {v}"); unsafe { env::set_var("PYTHONHOME", v) } } None => { @@ -239,8 +239,7 @@ pub(crate) fn initialize_venv(venv_path: &Path) -> Result<(), VenvError> { if !activate_script.exists() { return Err(VenvError::InitError(format!( - "Activation script not found at {:?}", - activate_script + "Activation script not found at {activate_script:?}" ))); } @@ -279,7 +278,7 @@ pub(crate) fn initialize_venv(venv_path: &Path) -> Result<(), VenvError> { }); if let Ok(v) = env::var("VIRTUAL_ENV") { - debug!("VIRTUAL_ENV set to: {}", v); + debug!("VIRTUAL_ENV set to: {v}"); } Ok(()) diff --git a/influxdb3_py_api/src/system_py.rs b/influxdb3_py_api/src/system_py.rs index cbabbe1cb6f..3183b5feccb 100644 --- a/influxdb3_py_api/src/system_py.rs +++ b/influxdb3_py_api/src/system_py.rs @@ -105,9 +105,9 @@ pub enum LogLine { impl std::fmt::Display for LogLine { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - LogLine::Info(s) => write!(f, "INFO: {}", s), - LogLine::Warn(s) => write!(f, "WARN: {}", s), - LogLine::Error(s) => write!(f, "ERROR: {}", s), + LogLine::Info(s) => write!(f, "INFO: {s}"), + LogLine::Warn(s) => write!(f, "WARN: {s}"), + LogLine::Error(s) => write!(f, "ERROR: {s}"), } } } @@ -212,20 +212,18 @@ impl PyPluginCallApi { let res = query_executor .query_sql(db_schema_name.as_ref(), &query, params, None, None) .await - .map_err(|e| { - QueryError::new_err(format!("error: {} executing query: {}", e, query)) - })?; + .map_err(|e| QueryError::new_err(format!("error: {e} executing query: {query}")))?; - res.try_collect().await.map_err(|e| { - QueryError::new_err(format!("error: {} executing query: {}", e, query)) - }) + res.try_collect() + .await + .map_err(|e| QueryError::new_err(format!("error: {e} executing query: {query}"))) }); // Block the current thread until the async task completes let res = tokio::task::block_in_place(|| tokio::runtime::Handle::current().block_on(handle)); - let res = res.map_err(|e| QueryError::new_err(format!("join error: {}", e)))?; + let res = res.map_err(|e| QueryError::new_err(format!("join error: {e}")))?; let batches: Vec = res?; @@ -644,7 +642,7 @@ pub fn execute_schedule_trigger( let start_time = if let Some(logger) = &logger { logger.log( LogLevel::Info, - format!("starting execution with scheduled time {}", schedule_time), + format!("starting execution with scheduled time {schedule_time}"), ); Some(logger.sys_event_store.time_provider().now()) } else { diff --git a/influxdb3_server/src/http.rs b/influxdb3_server/src/http.rs index dcfb9420891..06cf1624072 100644 --- a/influxdb3_server/src/http.rs +++ b/influxdb3_server/src/http.rs @@ -1266,7 +1266,7 @@ impl HttpApi { let uri = req.uri(); let query_str = uri.query().unwrap_or(""); - let parsed_url = url::Url::parse(&format!("http://influxdata.com?{}", query_str)).unwrap(); + let parsed_url = url::Url::parse(&format!("http://influxdata.com?{query_str}")).unwrap(); let params: HashMap = parsed_url .query_pairs() .map(|(k, v)| (k.to_string(), v.to_string())) diff --git a/influxdb3_server/src/lib.rs b/influxdb3_server/src/lib.rs index e09c1da995a..8f6c794feec 100644 --- a/influxdb3_server/src/lib.rs +++ b/influxdb3_server/src/lib.rs @@ -716,10 +716,7 @@ mod tests { // Make a DELETE request to delete the table without hard_delete_at parameter let client = Client::new(); - let url = format!( - "{}/api/v3/configure/table?db={}&table={}", - server, db_name, table_name - ); + let url = format!("{server}/api/v3/configure/table?db={db_name}&table={table_name}"); let request = RequestBuilder::new() .uri(url) @@ -772,8 +769,7 @@ mod tests { // Make a DELETE request to delete the table with explicit hard_delete_at=never parameter let client = Client::new(); let url = format!( - "{}/api/v3/configure/table?db={}&table={}&hard_delete_at=never", - server, db_name, table_name + "{server}/api/v3/configure/table?db={db_name}&table={table_name}&hard_delete_at=never" ); let request = RequestBuilder::new() @@ -827,8 +823,7 @@ mod tests { // Make a DELETE request to delete the table with explicit hard_delete_at=now parameter let client = Client::new(); let url = format!( - "{}/api/v3/configure/table?db={}&table={}&hard_delete_at=now", - server, db_name, table_name + "{server}/api/v3/configure/table?db={db_name}&table={table_name}&hard_delete_at=now" ); let request = RequestBuilder::new() @@ -890,8 +885,7 @@ mod tests { // Make a DELETE request to delete the table with explicit hard_delete_at timestamp let client = Client::new(); let url = format!( - "{}/api/v3/configure/table?db={}&table={}&hard_delete_at={}", - server, db_name, table_name, future_timestamp + "{server}/api/v3/configure/table?db={db_name}&table={table_name}&hard_delete_at={future_timestamp}" ); let request = RequestBuilder::new() @@ -946,8 +940,7 @@ mod tests { // Make a DELETE request to delete the table with explicit hard_delete_at=default parameter let client = Client::new(); let url = format!( - "{}/api/v3/configure/table?db={}&table={}&hard_delete_at=default", - server, db_name, table_name + "{server}/api/v3/configure/table?db={db_name}&table={table_name}&hard_delete_at=default" ); let request = RequestBuilder::new() @@ -999,10 +992,7 @@ mod tests { // Make a DELETE request to delete the database with explicit hard_delete_at=never parameter let client = Client::new(); - let url = format!( - "{}/api/v3/configure/database?db={}&hard_delete_at=never", - server, db_name - ); + let url = format!("{server}/api/v3/configure/database?db={db_name}&hard_delete_at=never"); let request = RequestBuilder::new() .uri(url) @@ -1050,7 +1040,7 @@ mod tests { // Make a DELETE request to delete the database without hard_delete_at parameter let client = Client::new(); - let url = format!("{}/api/v3/configure/database?db={}", server, db_name); + let url = format!("{server}/api/v3/configure/database?db={db_name}"); let request = RequestBuilder::new() .uri(url) @@ -1098,10 +1088,7 @@ mod tests { // Make a DELETE request to delete the database with explicit hard_delete_at=now parameter let client = Client::new(); - let url = format!( - "{}/api/v3/configure/database?db={}&hard_delete_at=now", - server, db_name - ); + let url = format!("{server}/api/v3/configure/database?db={db_name}&hard_delete_at=now"); let request = RequestBuilder::new() .uri(url) @@ -1149,10 +1136,7 @@ mod tests { // Make a DELETE request to delete the database with explicit hard_delete_at=default parameter let client = Client::new(); - let url = format!( - "{}/api/v3/configure/database?db={}&hard_delete_at=default", - server, db_name - ); + let url = format!("{server}/api/v3/configure/database?db={db_name}&hard_delete_at=default"); let request = RequestBuilder::new() .uri(url) @@ -1209,8 +1193,7 @@ mod tests { // Make a DELETE request to delete the database with explicit hard_delete_at timestamp let client = Client::new(); let url = format!( - "{}/api/v3/configure/database?db={}&hard_delete_at={}", - server, db_name, future_timestamp + "{server}/api/v3/configure/database?db={db_name}&hard_delete_at={future_timestamp}" ); let request = RequestBuilder::new() @@ -1545,7 +1528,7 @@ mod tests { database.into(), precision.into(), ); - println!("{}", url); + println!("{url}"); let mut builder = RequestBuilder::new().uri(url).method("POST"); if let Some(authorization) = authorization { @@ -1579,7 +1562,7 @@ mod tests { format.into() ); - println!("query url: {}", url); + println!("query url: {url}"); let mut builder = RequestBuilder::new().uri(url).method("GET"); if let Some(authorization) = authorization { builder = builder.header(hyper::header::AUTHORIZATION, authorization); diff --git a/influxdb3_wal/src/object_store.rs b/influxdb3_wal/src/object_store.rs index a6bfebe5469..9b3b4c4861e 100644 --- a/influxdb3_wal/src/object_store.rs +++ b/influxdb3_wal/src/object_store.rs @@ -574,7 +574,7 @@ async fn load_all_wal_file_paths( ) -> Result, crate::Error> { let mut paths = Vec::new(); let mut offset: Option = None; - let path = Path::from(format!("{writer}/wal", writer = node_identifier_prefix)); + let path = Path::from(format!("{node_identifier_prefix}/wal")); loop { let mut listing = if let Some(offset) = offset { object_store.list_with_offset(Some(&path), &offset) diff --git a/influxdb3_write/src/write_buffer/persisted_files.rs b/influxdb3_write/src/write_buffer/persisted_files.rs index ca9adfdc1ec..7c2a2219ec1 100644 --- a/influxdb3_write/src/write_buffer/persisted_files.rs +++ b/influxdb3_write/src/write_buffer/persisted_files.rs @@ -608,7 +608,7 @@ mod tests { let parquet_files: Vec = (0..num_files) .map(|i| ParquetFile { id: ParquetFileId::new(), - path: format!("/random/path/{prefix}_{}.parquet", i), + path: format!("/random/path/{prefix}_{i}.parquet"), size_bytes: 50_000, row_count: 10, chunk_time: 10, diff --git a/influxdb3_write/src/write_buffer/queryable_buffer.rs b/influxdb3_write/src/write_buffer/queryable_buffer.rs index e0ce38122e1..ffdf11c51b8 100644 --- a/influxdb3_write/src/write_buffer/queryable_buffer.rs +++ b/influxdb3_write/src/write_buffer/queryable_buffer.rs @@ -114,7 +114,7 @@ impl QueryableBuffer { Ok(table_buffer .partitioned_record_batches(Arc::clone(&table_def), buffer_filter) - .map_err(|e| DataFusionError::Execution(format!("error getting batches {}", e)))? + .map_err(|e| DataFusionError::Execution(format!("error getting batches {e}")))? .into_iter() .map(|(gen_time, (ts_min_max, batches))| { let row_count = batches.iter().map(|b| b.num_rows()).sum::(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5045547bde2..ab7da1a4375 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.87.0" +channel = "1.88" components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]