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 /openpgp-ffi/tests/c-tests.rs | |
parent | ca35fe181ed578f1fb4047de8dd8ea7595daec0d (diff) |
openpgp-ffi, ffi: Reword.
Diffstat (limited to 'openpgp-ffi/tests/c-tests.rs')
-rw-r--r-- | openpgp-ffi/tests/c-tests.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/openpgp-ffi/tests/c-tests.rs b/openpgp-ffi/tests/c-tests.rs index 06ab21a5..68bf9472 100644 --- a/openpgp-ffi/tests/c-tests.rs +++ b/openpgp-ffi/tests/c-tests.rs @@ -291,9 +291,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()); @@ -303,13 +302,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 + }) } |