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" diff --git a/src/migration.rs b/src/migration.rs index 14289e2..1bb6aeb 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -58,19 +58,20 @@ 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 { - anyhow::bail!( - "Input and output paths are the same. This would overwrite the original file." - ); - } + 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() { - anyhow::bail!("Output directory does not exist: {}", parent.display()); - } + 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) diff --git a/src/migration/rules/distributed_cache_services.rs b/src/migration/rules/distributed_cache_services.rs index 233e8f5..f67946a 100644 --- a/src/migration/rules/distributed_cache_services.rs +++ b/src/migration/rules/distributed_cache_services.rs @@ -53,14 +53,14 @@ 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() { - 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; - } + 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; } } } diff --git a/src/migration/rules/jolt_transform_json.rs b/src/migration/rules/jolt_transform_json.rs index 0cfa0eb..5998ac0 100644 --- a/src/migration/rules/jolt_transform_json.rs +++ b/src/migration/rules/jolt_transform_json.rs @@ -41,23 +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") - { - *type_field = - Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned()); - changed = true; - } + 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") { - *artifact = Value::String("nifi-jolt-nar".to_owned()); - changed = true; - } - } + 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 diff --git a/src/migration/rules/jolt_transform_record.rs b/src/migration/rules/jolt_transform_record.rs index 1298ff2..8a75bb4 100644 --- a/src/migration/rules/jolt_transform_record.rs +++ b/src/migration/rules/jolt_transform_record.rs @@ -44,24 +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; - } + { + *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") { - *artifact = Value::String("nifi-jolt-nar".to_owned()); - changed = true; - } - } + 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