1
- // Copyright 2016 Tyler Neely
1
+ // Copyright 2020 Tyler Neely
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -41,12 +41,7 @@ pub enum Decision {
41
41
///
42
42
/// [set_compaction_filter]: ../struct.Options.html#method.set_compaction_filter
43
43
pub trait CompactionFilterFn : FnMut ( u32 , & [ u8 ] , & [ u8 ] ) -> Decision { }
44
- impl < F > CompactionFilterFn for F
45
- where
46
- F : FnMut ( u32 , & [ u8 ] , & [ u8 ] ) -> Decision ,
47
- F : Send + ' static ,
48
- {
49
- }
44
+ impl < F > CompactionFilterFn for F where F : FnMut ( u32 , & [ u8 ] , & [ u8 ] ) -> Decision + Send + ' static { }
50
45
51
46
pub struct CompactionFilterCallback < F >
52
47
where
@@ -85,7 +80,7 @@ pub unsafe extern "C" fn filter_callback<F>(
85
80
where
86
81
F : CompactionFilterFn ,
87
82
{
88
- use self :: Decision :: * ;
83
+ use self :: Decision :: { Change , Keep , Remove } ;
89
84
90
85
let cb = & mut * ( raw_cb as * mut CompactionFilterCallback < F > ) ;
91
86
let key = slice:: from_raw_parts ( raw_key as * const u8 , key_length as usize ) ;
@@ -106,7 +101,7 @@ where
106
101
#[ cfg( test) ]
107
102
#[ allow( unused_variables) ]
108
103
fn test_filter ( level : u32 , key : & [ u8 ] , value : & [ u8 ] ) -> Decision {
109
- use self :: Decision :: * ;
104
+ use self :: Decision :: { Change , Keep , Remove } ;
110
105
match key. first ( ) {
111
106
Some ( & b'_' ) => Remove ,
112
107
Some ( & b'%' ) => Change ( b"secret" ) ,
0 commit comments