Skip to content

Commit 222abc9

Browse files
committed
feat: updated path import of definition reader
1 parent b3812c3 commit 222abc9

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/flow_validator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn verify_data_type_rules(
7171
}
7272
}
7373
Config::ContainsType(config) => {
74-
match apply_contains_type(config, &availabe_data_types, &body) {
74+
match apply_contains_type(config, availabe_data_types, &body) {
7575
Ok(_) => continue,
7676
Err(violation) => {
7777
violations.extend(violation.violations);
@@ -89,7 +89,7 @@ fn verify_data_type_rules(
8989
};
9090
}
9191
Config::ContainsKey(config) => {
92-
match apply_contains_key(config, &body, &availabe_data_types) {
92+
match apply_contains_key(config, &body, availabe_data_types) {
9393
Ok(_) => continue,
9494
Err(violation) => {
9595
violations.extend(violation.violations);

src/flow_validator/rule/contains_key.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn apply_contains_key(
3131
let identifier = rule.data_type_identifier;
3232

3333
if let Some(Kind::StructValue(_)) = &body.kind {
34-
let value = match expect_kind(&identifier, &body) {
34+
let value = match expect_kind(&identifier, body) {
3535
Some(value) => Value {
3636
kind: Some(value.to_owned()),
3737
},
@@ -46,7 +46,7 @@ pub fn apply_contains_key(
4646
}
4747
};
4848

49-
let data_type = match get_data_type_by_id(&available_data_types, &identifier) {
49+
let data_type = match get_data_type_by_id(available_data_types, &identifier) {
5050
Some(data_type) => data_type,
5151
None => {
5252
let error = MissingDataTypeRuleDefinition {
@@ -59,14 +59,14 @@ pub fn apply_contains_key(
5959
}
6060
};
6161

62-
return verify_data_type_rules(value, data_type, available_data_types);
62+
verify_data_type_rules(value, data_type, available_data_types)
6363
} else {
64-
return Err(DataTypeRuleError {
64+
Err(DataTypeRuleError {
6565
violations: vec![DataTypeRuleViolation::ContainsKey(
6666
ContainsKeyRuleViolation {
6767
missing_key: identifier,
6868
},
6969
)],
70-
});
70+
})
7171
}
7272
}

src/flow_validator/rule/contains_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn apply_contains_type(
4242
let mut rule_errors: Option<DataTypeRuleError> = None;
4343

4444
for value in list.values {
45-
match verify_data_type_rules(value, data_type.clone(), &available_data_types) {
45+
match verify_data_type_rules(value, data_type.clone(), available_data_types) {
4646
Ok(_) => {}
4747
Err(errors) => {
4848
rule_errors = Some(errors);

src/flow_validator/rule/number_range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn apply_number_range(
3030
};
3131

3232
let result = match kind {
33-
Kind::NumberValue(n) => n.clone(),
33+
Kind::NumberValue(n) => *n,
3434
_ => {
3535
return Err(DataTypeRuleError {
3636
violations: vec![DataTypeRuleViolation::RegexTypeNotAccepted(

src/flow_validator/rule/regex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ pub fn apply_regex(rule: DataTypeRegexRuleConfig, body: &Value) -> Result<(), Da
5151
let regex = regex::Regex::new(rule.pattern.as_str()).unwrap();
5252

5353
if !regex.is_match(&result) {
54-
return Err(DataTypeRuleError {
54+
Err(DataTypeRuleError {
5555
violations: vec![DataTypeRuleViolation::Regex(RegexRuleViolation {
5656
missing_regex: rule.pattern.clone(),
5757
})],
58-
});
58+
})
5959
} else {
6060
Ok(())
6161
}

0 commit comments

Comments
 (0)