Copilot commented on code in PR #2220:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2220#discussion_r3646721152


##########
minifi_rust/minifi_native/src/api/errors.rs:
##########
@@ -89,6 +92,18 @@ impl From<NulError> for MinifiError {
     }
 }
 
+impl From<ParseFloatError> for MinifiError {
+    fn from(err: ParseFloatError) -> Self {
+        MinifiError::Parse(ParseError::Float(err))
+    }
+}
+
+impl From<std::convert::Infallible> for MinifiError {
+    fn from(_: std::convert::Infallible) -> Self {
+        unreachable!("Infallible errors can never happen")
+    }
+}
+
 impl MinifiError {
     pub(crate) fn to_status(&self) -> minifi_status {
         match self {

Review Comment:
   `MissingRequiredAttribute` is now part of `MinifiError`, but `to_status()` 
currently maps it via the catch-all to UNKNOWN. It should be mapped explicitly 
(e.g., to VALIDATION_FAILED) so C-FFI callers get a meaningful status code.



##########
minifi_rust/minifi_native/src/api/processor_wrappers/flow_file_transform.rs:
##########
@@ -200,3 +213,42 @@ where
         }
     }
 }
+
+#[macro_export]
+macro_rules! unwrap_or_route {
+    ($result:expr, $route:expr) => {
+        match $result {
+            Ok(v) => v,
+            Err(e) => {
+                return Ok(TransformedFlowFile::route_without_changes($route));
+            }
+        }

Review Comment:
   In this macro arm, the `Err(e)` binding is unused (warning) and 
`TransformedFlowFile` is unqualified, so callers must have it in scope. Prefer 
`Err(_)` and `$crate::TransformedFlowFile` for macro hygiene.
   
   This issue also appears in the following locations of the same file:
   - line 232
   - line 237
   - line 246
   - line 250



##########
minifi_rust/minifi_native/src/c_ffi/c_ffi_property.rs:
##########
@@ -76,21 +77,24 @@ impl Property {
     fn create_c_allowed_values_vec_vec(properties: &[Self]) -> 
Vec<Vec<minifi_string_view>> {
         properties
             .iter()
-            .map(|p| {
-                p.allowed_values
+            .map(|p| match p.constraints {
+                PropertyConstraints::AllowedValues(allowed_values) => 
allowed_values

Review Comment:
   This `match p.constraints` moves `constraints` out of `&Property` (not 
`Copy`), which will not compile. Match on a reference instead.
   
   This issue also appears on line 94 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to