From 492795acec6099c7945abffc34f042854e6eb3db Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Fri, 28 Aug 2026 13:15:36 +0200 Subject: [PATCH 1/3] chore: Bump the Rust toolchain to 1.97.1 --- .github/workflows/nifi_migrate_pr.yaml | 2 +- .github/workflows/nifi_migrate_release.yaml | 2 +- .github/workflows/pre_commit.yaml | 2 +- rust-toolchain.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nifi_migrate_pr.yaml b/.github/workflows/nifi_migrate_pr.yaml index fdce254..50c2d8d 100644 --- a/.github/workflows/nifi_migrate_pr.yaml +++ b/.github/workflows/nifi_migrate_pr.yaml @@ -12,7 +12,7 @@ on: - "Cargo.*" env: - RUST_VERSION: 1.87.0 + RUST_VERSION: 1.97.1 permissions: {} diff --git a/.github/workflows/nifi_migrate_release.yaml b/.github/workflows/nifi_migrate_release.yaml index 5392485..c13d65a 100644 --- a/.github/workflows/nifi_migrate_release.yaml +++ b/.github/workflows/nifi_migrate_release.yaml @@ -9,7 +9,7 @@ on: - "rel/nifi-migrate-[0-9]+.[0-9]+.[0-9]+**" env: - RUST_VERSION: 1.87.0 + RUST_VERSION: 1.97.1 permissions: {} diff --git a/.github/workflows/pre_commit.yaml b/.github/workflows/pre_commit.yaml index c4c9f9e..e1501b5 100644 --- a/.github/workflows/pre_commit.yaml +++ b/.github/workflows/pre_commit.yaml @@ -7,7 +7,7 @@ on: pull_request: env: - RUST_TOOLCHAIN_VERSION: "1.87.0" + RUST_TOOLCHAIN_VERSION: "1.97.1" permissions: {} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3a7d4c2..e6da85c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 [toolchain] -channel = "1.87.0" +channel = "1.97.1" profile = "default" From d57942b43648b253ce783804eb22c3f9551e3958 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Fri, 28 Aug 2026 13:15:39 +0200 Subject: [PATCH 2/3] fix: Resolve lints introduced by Rust 1.97 --- src/migration.rs | 10 ++++------ src/migration/rules/distributed_cache_services.rs | 5 ++--- src/migration/rules/jolt_transform_json.rs | 13 +++++-------- src/migration/rules/jolt_transform_record.rs | 13 +++++-------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index 14289e2..612fafe 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -58,20 +58,18 @@ impl Migrator { .canonicalize() .with_context(|| format!("Failed to resolve input path: {}", input_path.display()))?; - if let Ok(canonical_output) = output_path.canonicalize() { - if canonical_input == canonical_output { + if let Ok(canonical_output) = output_path.canonicalize() + && canonical_input == canonical_output { anyhow::bail!( "Input and output paths are the same. This would overwrite the original file." ); } - } // Validate output directory exists - if let Some(parent) = output_path.parent() { - if !parent.as_os_str().is_empty() && !parent.exists() { + if let Some(parent) = output_path.parent() + && !parent.as_os_str().is_empty() && !parent.exists() { anyhow::bail!("Output directory does not exist: {}", parent.display()); } - } let file = fs::File::open(input_path) .with_context(|| format!("Failed to open input file: {}", input_path.display()))?; diff --git a/src/migration/rules/distributed_cache_services.rs b/src/migration/rules/distributed_cache_services.rs index 233e8f5..cfc4ed5 100644 --- a/src/migration/rules/distributed_cache_services.rs +++ b/src/migration/rules/distributed_cache_services.rs @@ -53,8 +53,8 @@ impl MigrationRule for DistributedCacheServicesMigration { fn apply(&self, component: &mut Value) -> bool { let mut changed = false; - if let Some(type_field) = component.get_mut("type") { - if let Some(current_type) = type_field.as_str() { + if let Some(type_field) = component.get_mut("type") + && let Some(current_type) = type_field.as_str() { for (old_type, new_type) in CACHE_SERVICE_MIGRATIONS { if current_type == old_type { *type_field = Value::String(new_type.to_string()); @@ -63,7 +63,6 @@ impl MigrationRule for DistributedCacheServicesMigration { } } } - } changed } diff --git a/src/migration/rules/jolt_transform_json.rs b/src/migration/rules/jolt_transform_json.rs index 0cfa0eb..9a41ead 100644 --- a/src/migration/rules/jolt_transform_json.rs +++ b/src/migration/rules/jolt_transform_json.rs @@ -41,24 +41,21 @@ impl MigrationRule for JoltTransformJsonMigration { let mut changed = false; // Update the type field - if let Some(type_field) = processor.get_mut("type") { - if type_field.as_str() == Some("org.apache.nifi.processors.standard.JoltTransformJSON") + if let Some(type_field) = processor.get_mut("type") + && type_field.as_str() == Some("org.apache.nifi.processors.standard.JoltTransformJSON") { *type_field = Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned()); changed = true; } - } // Update the bundle artifact field - if let Some(bundle) = processor.get_mut("bundle") { - if let Some(artifact) = bundle.get_mut("artifact") { - if artifact.as_str() == Some("nifi-standard-nar") { + if let Some(bundle) = processor.get_mut("bundle") + && let Some(artifact) = bundle.get_mut("artifact") + && artifact.as_str() == Some("nifi-standard-nar") { *artifact = Value::String("nifi-jolt-nar".to_owned()); changed = true; } - } - } // Migrate properties: rename old property keys to new ones if let Some(properties) = processor diff --git a/src/migration/rules/jolt_transform_record.rs b/src/migration/rules/jolt_transform_record.rs index 1298ff2..9affac3 100644 --- a/src/migration/rules/jolt_transform_record.rs +++ b/src/migration/rules/jolt_transform_record.rs @@ -44,25 +44,22 @@ impl MigrationRule for JoltTransformRecordMigration { let mut changed = false; // Update the type field - if let Some(type_field) = processor.get_mut("type") { - if type_field.as_str() + if let Some(type_field) = processor.get_mut("type") + && type_field.as_str() == Some("org.apache.nifi.processors.jolt.record.JoltTransformRecord") { *type_field = Value::String("org.apache.nifi.processors.jolt.JoltTransformRecord".to_owned()); changed = true; } - } // Update the bundle artifact field - if let Some(bundle) = processor.get_mut("bundle") { - if let Some(artifact) = bundle.get_mut("artifact") { - if artifact.as_str() == Some("nifi-jolt-record-nar") { + if let Some(bundle) = processor.get_mut("bundle") + && let Some(artifact) = bundle.get_mut("artifact") + && artifact.as_str() == Some("nifi-jolt-record-nar") { *artifact = Value::String("nifi-jolt-nar".to_owned()); changed = true; } - } - } // Migrate properties: rename old property keys to new ones if let Some(properties) = processor From 0d094ef6315c8ee56e88d893b88b8af97a11412c Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Fri, 28 Aug 2026 13:15:39 +0200 Subject: [PATCH 3/3] style: Reformat with the rustfmt the repository pins --- src/migration.rs | 19 +++++++++++-------- .../rules/distributed_cache_services.rs | 15 ++++++++------- src/migration/rules/jolt_transform_json.rs | 19 ++++++++++--------- src/migration/rules/jolt_transform_record.rs | 19 ++++++++++--------- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index 612fafe..1bb6aeb 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -59,17 +59,20 @@ impl Migrator { .with_context(|| format!("Failed to resolve input path: {}", input_path.display()))?; if let Ok(canonical_output) = output_path.canonicalize() - && canonical_input == canonical_output { - anyhow::bail!( - "Input and output paths are the same. This would overwrite the original file." - ); - } + && canonical_input == canonical_output + { + anyhow::bail!( + "Input and output paths are the same. This would overwrite the original file." + ); + } // Validate output directory exists if let Some(parent) = output_path.parent() - && !parent.as_os_str().is_empty() && !parent.exists() { - anyhow::bail!("Output directory does not exist: {}", parent.display()); - } + && !parent.as_os_str().is_empty() + && !parent.exists() + { + anyhow::bail!("Output directory does not exist: {}", parent.display()); + } let file = fs::File::open(input_path) .with_context(|| format!("Failed to open input file: {}", input_path.display()))?; diff --git a/src/migration/rules/distributed_cache_services.rs b/src/migration/rules/distributed_cache_services.rs index cfc4ed5..f67946a 100644 --- a/src/migration/rules/distributed_cache_services.rs +++ b/src/migration/rules/distributed_cache_services.rs @@ -54,15 +54,16 @@ impl MigrationRule for DistributedCacheServicesMigration { let mut changed = false; if let Some(type_field) = component.get_mut("type") - && let Some(current_type) = type_field.as_str() { - for (old_type, new_type) in CACHE_SERVICE_MIGRATIONS { - if current_type == old_type { - *type_field = Value::String(new_type.to_string()); - changed = true; - break; - } + && let Some(current_type) = type_field.as_str() + { + for (old_type, new_type) in CACHE_SERVICE_MIGRATIONS { + if current_type == old_type { + *type_field = Value::String(new_type.to_string()); + changed = true; + break; } } + } changed } diff --git a/src/migration/rules/jolt_transform_json.rs b/src/migration/rules/jolt_transform_json.rs index 9a41ead..5998ac0 100644 --- a/src/migration/rules/jolt_transform_json.rs +++ b/src/migration/rules/jolt_transform_json.rs @@ -43,19 +43,20 @@ impl MigrationRule for JoltTransformJsonMigration { // Update the type field if let Some(type_field) = processor.get_mut("type") && type_field.as_str() == Some("org.apache.nifi.processors.standard.JoltTransformJSON") - { - *type_field = - Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned()); - changed = true; - } + { + *type_field = + Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned()); + changed = true; + } // Update the bundle artifact field if let Some(bundle) = processor.get_mut("bundle") && let Some(artifact) = bundle.get_mut("artifact") - && artifact.as_str() == Some("nifi-standard-nar") { - *artifact = Value::String("nifi-jolt-nar".to_owned()); - changed = true; - } + && artifact.as_str() == Some("nifi-standard-nar") + { + *artifact = Value::String("nifi-jolt-nar".to_owned()); + changed = true; + } // Migrate properties: rename old property keys to new ones if let Some(properties) = processor diff --git a/src/migration/rules/jolt_transform_record.rs b/src/migration/rules/jolt_transform_record.rs index 9affac3..8a75bb4 100644 --- a/src/migration/rules/jolt_transform_record.rs +++ b/src/migration/rules/jolt_transform_record.rs @@ -47,19 +47,20 @@ impl MigrationRule for JoltTransformRecordMigration { if let Some(type_field) = processor.get_mut("type") && type_field.as_str() == Some("org.apache.nifi.processors.jolt.record.JoltTransformRecord") - { - *type_field = - Value::String("org.apache.nifi.processors.jolt.JoltTransformRecord".to_owned()); - changed = true; - } + { + *type_field = + Value::String("org.apache.nifi.processors.jolt.JoltTransformRecord".to_owned()); + changed = true; + } // Update the bundle artifact field if let Some(bundle) = processor.get_mut("bundle") && let Some(artifact) = bundle.get_mut("artifact") - && artifact.as_str() == Some("nifi-jolt-record-nar") { - *artifact = Value::String("nifi-jolt-nar".to_owned()); - changed = true; - } + && artifact.as_str() == Some("nifi-jolt-record-nar") + { + *artifact = Value::String("nifi-jolt-nar".to_owned()); + changed = true; + } // Migrate properties: rename old property keys to new ones if let Some(properties) = processor