From 1a1a7f1e6ba503347ef646d9658da649b5b57ffb Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Mon, 16 Dec 2024 10:44:46 -0500 Subject: [PATCH] acceptor: remove simple test helper The `make_acceptor()` test helper is only used in 2 places, and just directly invokes a simple constructor. Let's do that in the call-sites directly instead of adding unhelpful indirection. --- src/acceptor.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/acceptor.rs b/src/acceptor.rs index 4395397a..d67d79d3 100644 --- a/src/acceptor.rs +++ b/src/acceptor.rs @@ -533,10 +533,6 @@ mod tests { rustls_acceptor::rustls_acceptor_free(acceptor); } - fn make_acceptor() -> *mut rustls_acceptor { - rustls_acceptor::rustls_acceptor_new() - } - unsafe extern "C" fn vecdeque_read( userdata: *mut c_void, buf: *mut u8, @@ -570,7 +566,7 @@ mod tests { // Send junk data to a rustls_acceptor, expect MessageInvalidContentType from accept(). #[test] fn test_acceptor_corrupt_message() { - let acceptor = make_acceptor(); + let acceptor = rustls_acceptor::rustls_acceptor_new(); let mut accepted = null_mut(); let mut accepted_alert = null_mut(); @@ -712,7 +708,7 @@ mod tests { #[cfg_attr(miri, ignore)] #[test] fn test_acceptor_success() { - let acceptor = make_acceptor(); + let acceptor = rustls_acceptor::rustls_acceptor_new(); let mut accepted = null_mut(); let mut accepted_alert = null_mut();