Skip to content

Commit 7c31c6e

Browse files
Merge pull request #148 from WhyNotHugo/is_empty
Ignore clippy warning when length must be >= 1
2 parents 015113f + 61f61ce commit 7c31c6e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

xsd-parser/src/generator/validator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ fn gen_min_length_validation(value: &str, name: &str) -> String {
129129

130130
format!(
131131
r#"
132+
#[allow(clippy::len_zero)]
132133
if self.{name}.len() < {value} {{
133134
return Err(format!("MinLength validation error. \nExpected: {name} length >= {value} \nActual: {name} length == {{}}", self.{name}.len()));
134135
}}"#,
@@ -208,6 +209,7 @@ mod test {
208209
#[test]
209210
fn test_gen_min_length_validation() {
210211
let expected = r#"
212+
#[allow(clippy::len_zero)]
211213
if self.name.len() < 50 {
212214
return Err(format!("MinLength validation error. \nExpected: name length >= 50 \nActual: name length == {}", self.name.len()));
213215
}"#;

0 commit comments

Comments
 (0)