diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 18:23:26 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 18:25:03 +0200 |
commit | 3d5f1bc2c1033e4c2c3f7bc17073ebe7cebad66c (patch) | |
tree | a07d015631049e5d3848f75250824634d269fba7 /ffi | |
parent | ca35fe181ed578f1fb4047de8dd8ea7595daec0d (diff) |
openpgp-ffi, ffi: Reword.
Diffstat (limited to 'ffi')
-rw-r--r-- | ffi/tests/c-tests.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ffi/tests/c-tests.rs b/ffi/tests/c-tests.rs index a5bd1f67..986468fd 100644 --- a/ffi/tests/c-tests.rs +++ b/ffi/tests/c-tests.rs @@ -292,9 +292,8 @@ fn wrap_with_main(test: &mut Vec<String>, offset: usize) { } test.insert(last_include + 2, format!("#line {}", last_include + offset + if needs_wrapping {1} else {0})); - let last = test.len(); if needs_wrapping { - test.insert(last, "}".into()); + test.push("}".into()); } test.insert(0, "#include <string.h>".into()); test.insert(0, "#include <stdlib.h>".into()); @@ -304,13 +303,9 @@ fn wrap_with_main(test: &mut Vec<String>, offset: usize) { /// Checks if the code contains a main function. fn has_main(test: &mut Vec<String>) -> bool { - for line in test { - if line.contains("main()") || line.contains("main ()") + test.iter().any(|line| { + line.contains("main()") || line.contains("main ()") || line.contains("main(int argc, char **argv)") || line.contains("main (int argc, char **argv)") - { - return true; - } - } - false + }) } |