diff options
author | Christian Poveda <31802960+pvdrz@users.noreply.github.com> | 2022-10-18 12:19:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 12:19:40 -0500 |
commit | 68c741d42d2d312037a978ac16e80d0bcc88bbef (patch) | |
tree | 1d17e6342b8ee0fbc3a74ab16b145480fe10c6ed /bindgen-tests/tests/quickchecking/src/fuzzers.rs | |
parent | 66388deae3b363cebc07d3e0b5570565bc5bb482 (diff) | |
parent | c1d1f1b694952cd91dc4e24614d65e70e2dadf84 (diff) |
Merge pull request #2313 from ferrous-systems/fix-clippy-lints
Fix clippy lints
Diffstat (limited to 'bindgen-tests/tests/quickchecking/src/fuzzers.rs')
-rw-r--r-- | bindgen-tests/tests/quickchecking/src/fuzzers.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/bindgen-tests/tests/quickchecking/src/fuzzers.rs b/bindgen-tests/tests/quickchecking/src/fuzzers.rs index b609dd5a..4188f8f5 100644 --- a/bindgen-tests/tests/quickchecking/src/fuzzers.rs +++ b/bindgen-tests/tests/quickchecking/src/fuzzers.rs @@ -327,12 +327,7 @@ impl Arbitrary for ArrayDimensionC { let dimensions = g.gen_range(0, 5); let mut def = String::new(); - let lower_bound; - if cfg!(feature = "zero-sized-arrays") { - lower_bound = 0; - } else { - lower_bound = 1; - } + let lower_bound = i32::from(cfg!(feature = "zero-sized-arrays")); for _ in 1..dimensions { // 16 is an arbitrary "not too big" number for capping array size. @@ -400,7 +395,7 @@ impl Arbitrary for StructDeclarationC { fn arbitrary<G: Gen>(g: &mut G) -> StructDeclarationC { // Reduce generator size as a method of putting a bound on recursion. // When size < 1 the empty list is generated. - let reduced_size: usize = (g.size() / 2) as usize + 1; + let reduced_size: usize = (g.size() / 2) + 1; let mut decl_list: DeclarationListC = Arbitrary::arbitrary(&mut StdGen::new(thread_rng(), reduced_size)); let mut fields: DeclarationListC = DeclarationListC { decls: vec![] }; @@ -448,7 +443,7 @@ impl Arbitrary for UnionDeclarationC { fn arbitrary<G: Gen>(g: &mut G) -> UnionDeclarationC { // Reduce generator size as a method of putting a bound on recursion. // When size < 1 the empty list is generated. - let reduced_size: usize = (g.size() / 2) as usize + 1; + let reduced_size: usize = (g.size() / 2) + 1; let mut decl_list: DeclarationListC = Arbitrary::arbitrary(&mut StdGen::new(thread_rng(), reduced_size)); let mut fields: DeclarationListC = DeclarationListC { decls: vec![] }; |