Skip to content

Commit

Permalink
Merge pull request #148 from WhyNotHugo/is_empty
Browse files Browse the repository at this point in the history
Ignore clippy warning when length must be >= 1
  • Loading branch information
DmitrySamoylov authored Oct 12, 2023
2 parents 015113f + 61f61ce commit 7c31c6e
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 7c31c6e

Please sign in to comment.