diff options
author | cypherpunks <cypherpunks@torproject.org> | 2018-08-03 19:48:10 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-08-16 08:42:57 -0400 |
commit | 6b609ce4356423a28e7b421a9f09849d831a0c6f (patch) | |
tree | 0feff6aae6ea11f4933d47e96949539c32368e3d /src/rust/tor_allocate | |
parent | 32ad8e991999277948e896196731f2919c390f00 (diff) | |
download | tor-6b609ce4356423a28e7b421a9f09849d831a0c6f.tar.gz tor-6b609ce4356423a28e7b421a9f09849d831a0c6f.zip |
rust: run rustfmt
Diffstat (limited to 'src/rust/tor_allocate')
-rw-r--r-- | src/rust/tor_allocate/tor_allocate.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rust/tor_allocate/tor_allocate.rs b/src/rust/tor_allocate/tor_allocate.rs index d0c0d79943..48351d8482 100644 --- a/src/rust/tor_allocate/tor_allocate.rs +++ b/src/rust/tor_allocate/tor_allocate.rs @@ -3,9 +3,9 @@ // No-op defined purely for testing at the module level use libc::c_char; -#[cfg(not(feature = "testing"))] -use std::{ptr, slice, mem}; use libc::c_void; +#[cfg(not(feature = "testing"))] +use std::{mem, ptr, slice}; // Define a no-op implementation for testing Rust modules without linking to C #[cfg(feature = "testing")] @@ -72,15 +72,14 @@ mod test { #[test] fn test_allocate_and_copy_string_with_empty() { + use libc::{c_void, free}; use std::ffi::CStr; - use libc::{free, c_void}; use tor_allocate::allocate_and_copy_string; let allocated_empty = allocate_and_copy_string(""); - let allocated_empty_rust = - unsafe { CStr::from_ptr(allocated_empty).to_str().unwrap() }; + let allocated_empty_rust = unsafe { CStr::from_ptr(allocated_empty).to_str().unwrap() }; assert_eq!("", allocated_empty_rust); @@ -89,15 +88,14 @@ mod test { #[test] fn test_allocate_and_copy_string_with_not_empty_string() { + use libc::{c_void, free}; use std::ffi::CStr; - use libc::{free, c_void}; use tor_allocate::allocate_and_copy_string; let allocated_empty = allocate_and_copy_string("foo bar biz"); - let allocated_empty_rust = - unsafe { CStr::from_ptr(allocated_empty).to_str().unwrap() }; + let allocated_empty_rust = unsafe { CStr::from_ptr(allocated_empty).to_str().unwrap() }; assert_eq!("foo bar biz", allocated_empty_rust); |