File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ pub trait AsName {
4646
4747impl AsName for [ u8 ] {
4848 fn name ( & self ) -> & Name {
49- use str;
5049 assert ! (
5150 !self . is_empty( ) ,
5251 "cannot create Name from empty byte-string"
@@ -125,14 +124,12 @@ impl Name {
125124
126125impl fmt:: Debug for Name {
127126 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
128- use str;
129127 write ! ( f, "{}" , str :: from_utf8( & self . 0 ) . unwrap( ) )
130128 }
131129}
132130
133131impl fmt:: Display for Name {
134132 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
135- use str;
136133 write ! ( f, "{}" , str :: from_utf8( & self . 0 ) . unwrap( ) )
137134 }
138135}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ const alignof_max_align_t: usize = 8;
6060 target_arch = "s390x" ,
6161 target_arch = "sparc64"
6262) ) ) ]
63- const alignof_max_align_t : usize = 16 ;
63+ const ALIGNOF_MAX_ALIGN_T : usize = 16 ;
6464
6565/// If `align` is less than `_Alignof(max_align_t)`, and if the requested
6666/// allocation `size` is larger than the alignment, we are guaranteed to get a
@@ -69,7 +69,7 @@ const alignof_max_align_t: usize = 16;
6969///
7070/// Otherwise, it returns the alignment flag to pass to the jemalloc APIs.
7171fn layout_to_flags ( align : usize , size : usize ) -> c_int {
72- if align <= alignof_max_align_t && align <= size {
72+ if align <= ALIGNOF_MAX_ALIGN_T && align <= size {
7373 0
7474 } else {
7575 ffi:: MALLOCX_ALIGN ( align)
@@ -122,7 +122,7 @@ unsafe impl GlobalAlloc for Jemalloc {
122122
123123 #[ inline]
124124 unsafe fn dealloc ( & self , ptr : * mut u8 , layout : Layout ) {
125- assume ! ( !ptr. is_null( ) )
125+ assume ! ( !ptr. is_null( ) ) ;
126126 assume ! ( layout. size( ) != 0 ) ;
127127 let flags = layout_to_flags ( layout. align ( ) , layout. size ( ) ) ;
128128 ffi:: sdallocx ( ptr as * mut c_void , layout. size ( ) , flags)
Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ jemalloc-sys = { path = "../jemalloc-sys" }
99libc = " 0.2"
1010
1111[build-dependencies ]
12- ctest = " ^ 0.2.6 "
12+ ctest = " 0.2.22 "
Original file line number Diff line number Diff line change @@ -3,6 +3,17 @@ extern crate ctest;
33use std:: env;
44use std:: path:: PathBuf ;
55
6+ const FUNCTION_POINTER : & [ & str ] = & [
7+ "extent_alloc_t" ,
8+ "extent_dalloc_t" ,
9+ "extent_destroy_t" ,
10+ "extent_commit_t" ,
11+ "extent_decommit_t" ,
12+ "extent_purge_t" ,
13+ "extent_split_t" ,
14+ "extent_merge_t" ,
15+ ] ;
16+
617fn main ( ) {
718 let root = PathBuf :: from ( env:: var_os ( "DEP_JEMALLOC_ROOT" ) . unwrap ( ) ) ;
819
@@ -11,7 +22,9 @@ fn main() {
1122 . include ( root. join ( "include" ) )
1223 . cfg ( "prefixed" , None )
1324 . fn_cname ( |rust, link_name| link_name. unwrap_or ( rust) . to_string ( ) )
14- . skip_signededness ( |c| c. ends_with ( "_t" ) ) ;
25+ . skip_signededness ( |c| c. ends_with ( "_t" ) )
26+ // No need to test pure C function pointer.
27+ . skip_type ( |name| FUNCTION_POINTER . contains ( & name) ) ;
1528
1629 if cfg ! ( target_os = "linux" ) {
1730 cfg. skip_fn ( |f| f == "malloc_usable_size" ) ;
You can’t perform that action at this time.
0 commit comments