diff --git a/regex-capi/src/error.rs b/regex-capi/src/error.rs index 2ca3fae804bc657a1ca3320bab3f0775ee9d302f..01d85c70cc7dfb7bb3023492706c5e45937c8629 100644 --- a/regex-capi/src/error.rs +++ b/regex-capi/src/error.rs @@ -22,15 +22,16 @@ pub enum ErrorKind { impl Error { pub fn new(kind: ErrorKind) -> Error { - Error { message: None, kind: kind } + Error { + message: None, + kind: kind, + } } pub fn is_err(&self) -> bool { match self.kind { ErrorKind::None => false, - ErrorKind::Str(_) | ErrorKind::Regex(_) | ErrorKind::Nul(_) => { - true - } + ErrorKind::Str(_) | ErrorKind::Regex(_) | ErrorKind::Nul(_) => true, } } } diff --git a/regex-capi/src/rure.rs b/regex-capi/src/rure.rs index 53cc5f969d408f24969239689c801440fa4f93a5..cb4c7021809f5a879a589470365b39ad14e2344e 100644 --- a/regex-capi/src/rure.rs +++ b/regex-capi/src/rure.rs @@ -70,7 +70,10 @@ impl Deref for RegexSet { impl Default for Options { fn default() -> Options { - Options { size_limit: 10 * (1 << 20), dfa_size_limit: 2 * (1 << 20) } + Options { + size_limit: 10 * (1 << 20), + dfa_size_limit: 2 * (1 << 20), + } } } @@ -595,11 +598,7 @@ ffi_fn! { /// This should ideally be exposed, but it needs API design work. In /// particular, this should not return a C string, but a `const uint8_t *` /// instead, since it may contain a NUL byte. -fn rure_escape( - pattern: *const u8, - length: size_t, - error: *mut Error, -) -> *const c_char { +fn rure_escape(pattern: *const u8, length: size_t, error: *mut Error) -> *const c_char { let pat: &[u8] = unsafe { slice::from_raw_parts(pattern, length) }; let str_pat = match str::from_utf8(pat) { Ok(val) => val, @@ -650,7 +649,7 @@ ffi_fn! { }, }; c_esc_pat.into_raw() as *const c_char - + } } @@ -676,7 +675,7 @@ ffi_fn! { }, }; c_esc_pat.into_raw() as *const c_char - + } } @@ -684,7 +683,7 @@ ffi_fn! { * Simple way to use regex */ - ffi_fn! { +ffi_fn! { fn rure_new( pattern: *const u8, length: size_t, @@ -721,4 +720,4 @@ ffi_fn! { }).is_some() } -} \ No newline at end of file +}