Skip to content

Commit

Permalink
Set semi colons appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Feb 29, 2024
1 parent 8ca2512 commit a450174
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/dsl/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ pub fn validate(
let is_expect_same = expect_same.is_some();
let is_expect_enum = expect_enum.is_some();

let mut results = vec![];

let expectation_expression = if is_expect {
expect.unwrap().as_str().unwrap()
} else if is_expect_same {
Expand All @@ -65,14 +63,16 @@ pub fn validate(
""
};

let mut results = vec![];

match engine.compile(expectation_expression) {
Ok(_) => results.push(Ok(())),
Err(error) => results.push(Err(ValidationError {
check_id: check_id.to_string(),
error: error.to_string(),
instance_path: format!("/expectations/{:?}", index).to_string(),
})),
};
}

if failure_message.is_some() {
let failure_message_expression = failure_message.unwrap().as_str().unwrap();
Expand All @@ -83,14 +83,14 @@ pub fn validate(
index,
is_expect,
));
};
}

if warning_message.is_some() && !is_expect_enum {
results.push(Err(ValidationError {
check_id: check_id.to_string(),
error: "warning_message is only available for expect_enum expectations".to_string(),
instance_path: format!("/expectations/{:?}", index).to_string(),
}))
}));
} else if warning_message.is_some() {
let warning_message_expression = warning_message.unwrap().as_str().unwrap();
results.push(validate_string_expression(
Expand All @@ -100,15 +100,15 @@ pub fn validate(
index,
is_expect_enum,
));
};
}

if is_expect_enum {
results.append(&mut validate_expect_enum_content(
expectation_expression,
check_id,
index,
));
};
}

results
})
Expand Down

0 comments on commit a450174

Please sign in to comment.