Validates that positional arguments come before named arguments
(arg_names: &[Option<ArgumentName>])
| 85 | |
| 86 | /// Validates that positional arguments come before named arguments |
| 87 | fn validate_argument_order(arg_names: &[Option<ArgumentName>]) -> Result<()> { |
| 88 | let mut seen_named = false; |
| 89 | for (i, arg_name) in arg_names.iter().enumerate() { |
| 90 | match arg_name { |
| 91 | Some(_) => seen_named = true, |
| 92 | None if seen_named => { |
| 93 | return plan_err!( |
| 94 | "Positional argument at position {} follows named argument. \ |
| 95 | All positional arguments must come before named arguments.", |
| 96 | i |
| 97 | ); |
| 98 | } |
| 99 | None => {} |
| 100 | } |
| 101 | } |
| 102 | Ok(()) |
| 103 | } |
| 104 | |
| 105 | /// Reorders arguments based on named parameters to match signature order |
| 106 | fn reorder_named_arguments( |
no test coverage detected
searching dependent graphs…