Skip to content

Commit 455a173

Browse files
committed
Drop block, make error message consistent
1 parent d23de3e commit 455a173

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/cachedev.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ impl FromStr for CacheTargetParams {
106106

107107
let end_feature_args_index = 6 + num_feature_args;
108108

109-
if vals.len() <= end_feature_args_index + 1 {
110-
let err_msg = format!("Only {} arguments provided, expected more", vals.len());
109+
if vals.len() <= end_feature_args_index + 1 {
110+
let err_msg = format!("Expected {} feature arguments but found {}", vals[5], vals.len() - 6);
111111
return Err(DmError::Dm(ErrorEnum::Invalid, err_msg));
112112
}
113113

@@ -125,12 +125,6 @@ impl FromStr for CacheTargetParams {
125125
let num_policy_args: usize =
126126
parse_value(vals[end_feature_args_index + 1], "number of policy args")?;
127127

128-
let num_expected_args = 8 + num_feature_args + num_policy_args;
129-
if vals.len() < num_expected_args {
130-
let err_msg = format!("Based on number of feature arguments and policy args provided, {} arguments were expected, but {} were provided", num_expected_args, vals.len());
131-
return Err(DmError::Dm(ErrorEnum::Invalid, err_msg));
132-
}
133-
134128
let start_policy_args_index = end_feature_args_index + 2;
135129
let end_policy_args_index = start_policy_args_index + num_policy_args;
136130
let policy_args: Vec<(String, String)> = vals

0 commit comments

Comments
 (0)