Skip to content

Commit

Permalink
Ignore clippy warning when length must be >= 1
Browse files Browse the repository at this point in the history
Fixes: #120
  • Loading branch information
WhyNotHugo committed Oct 3, 2023
1 parent d8dd37e commit cd7cbf4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xsd-parser/src/generator/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ fn gen_min_length_validation(value: &str, name: &str) -> String {

format!(
r#"
#[allow(clippy::len_zero)]
if self.{name}.len() < {value} {{
return Err(format!("MinLength validation error. \nExpected: {name} length >= {value} \nActual: {name} length == {{}}", self.{name}.len()));
}}"#,
Expand Down Expand Up @@ -208,6 +209,7 @@ mod test {
#[test]
fn test_gen_min_length_validation() {
let expected = r#"
#[allow(clippy::len_zero)]
if self.name.len() < 50 {
return Err(format!("MinLength validation error. \nExpected: name length >= 50 \nActual: name length == {}", self.name.len()));
}"#;
Expand Down

0 comments on commit cd7cbf4

Please sign in to comment.