From 8a645855202f6a9e02c14d67365d97bbd635ba82 Mon Sep 17 00:00:00 2001 From: Rick Richardson Date: Wed, 18 Oct 2017 22:20:04 -0700 Subject: [PATCH] changed try_ffi to take trailing comma and updated rustfmt accordingly --- rustfmt.toml | 1 + src/backup.rs | 2 +- src/db.rs | 11 +++++------ src/ffi_util.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index 2e81e37..6582e8c 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,4 @@ reorder_imports = true max_width = 100 ideal_width = 100 +trailing_comma = always diff --git a/src/backup.rs b/src/backup.rs index 07082ce..9319f4d 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -52,7 +52,7 @@ impl BackupEngine { }; let be: *mut ffi::rocksdb_backup_engine_t; - unsafe { be = ffi_try!(ffi::rocksdb_backup_engine_open(opts.inner, cpath.as_ptr())) } + unsafe { be = ffi_try!(ffi::rocksdb_backup_engine_open(opts.inner, cpath.as_ptr(),)) } if be.is_null() { return Err(Error::new("Could not initialize backup engine.".to_owned())); diff --git a/src/db.rs b/src/db.rs index 516a25f..256f12f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -618,7 +618,7 @@ impl DB { if cfs.len() == 0 { unsafe { - db = ffi_try!(ffi::rocksdb_open(opts.inner, cpath.as_ptr() as *const _)); + db = ffi_try!(ffi::rocksdb_open(opts.inner, cpath.as_ptr() as *const _,)); } } else { let mut cfs_v = cfs.to_vec(); @@ -652,8 +652,7 @@ impl DB { cfs_v.len() as c_int, cfnames.as_mut_ptr(), cfopts.as_mut_ptr(), - cfhandles.as_mut_ptr(), - )); + cfhandles.as_mut_ptr(),)); } for handle in &cfhandles { @@ -716,7 +715,7 @@ impl DB { pub fn destroy>(opts: &Options, path: P) -> Result<(), Error> { let cpath = CString::new(path.as_ref().to_string_lossy().as_bytes()).unwrap(); unsafe { - ffi_try!(ffi::rocksdb_destroy_db(opts.inner, cpath.as_ptr())); + ffi_try!(ffi::rocksdb_destroy_db(opts.inner, cpath.as_ptr(),)); } Ok(()) } @@ -724,7 +723,7 @@ impl DB { pub fn repair>(opts: Options, path: P) -> Result<(), Error> { let cpath = CString::new(path.as_ref().to_string_lossy().as_bytes()).unwrap(); unsafe { - ffi_try!(ffi::rocksdb_repair_db(opts.inner, cpath.as_ptr())); + ffi_try!(ffi::rocksdb_repair_db(opts.inner, cpath.as_ptr(),)); } Ok(()) } @@ -735,7 +734,7 @@ impl DB { pub fn write_opt(&self, batch: WriteBatch, writeopts: &WriteOptions) -> Result<(), Error> { unsafe { - ffi_try!(ffi::rocksdb_write(self.inner, writeopts.inner, batch.inner)); + ffi_try!(ffi::rocksdb_write(self.inner, writeopts.inner, batch.inner,)); } Ok(()) } diff --git a/src/ffi_util.rs b/src/ffi_util.rs index e9b3119..49c298e 100644 --- a/src/ffi_util.rs +++ b/src/ffi_util.rs @@ -34,7 +34,7 @@ pub fn opt_bytes_to_ptr(opt: Option<&[u8]>) -> *const c_char { } macro_rules! ffi_try { - ( $($function:ident)::*( $( $arg:expr ),* ) ) => ({ + ( $($function:ident)::*( $( $arg:expr,)* ) ) => ({ let mut err: *mut ::libc::c_char = ::std::ptr::null_mut(); let result = $($function)::*($($arg),*, &mut err); if !err.is_null() {