qinkunbao commented on a change in pull request #603:
URL: https://github.com/apache/incubator-teaclave/pull/603#discussion_r798207225



##########
File path: types/src/task_state.rs
##########
@@ -135,12 +136,29 @@ impl Task<Create> {
 
         // check input fkeys
         let inputs_spec: HashSet<&String> = function.inputs.iter().map(|f| 
&f.name).collect();
-        let req_input_fkeys: HashSet<&String> = 
req_input_owners.keys().collect();
+        let mut req_input_fkeys: HashSet<&String> = 
req_input_owners.keys().collect();
+        // If an input/output file is marked with `optional: True`, users do 
not need to
+        // register the file.
+        let option_inputs_spec: HashSet<&String> = function
+            .inputs
+            .iter()
+            .filter(|f| f.optional)
+            .map(|f| &f.name)

Review comment:
       I cannot come up with better ways of rewriting the code with 
`filter_map`. Do we have to replace it with the `filter_map`?
   ```Rust
   let option_inputs_spec: HashSet<&String> = function
               .outputs
               .iter()
               .filter_map(|f| if f.optional { Some(&f.name) } else { None })
               .collect();
   ```




-- 
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: notifications-unsubscr...@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@teaclave.apache.org
For additional commands, e-mail: notifications-h...@teaclave.apache.org

Reply via email to