From e646999c71360497660a316520c72d88ad61dcc9 Mon Sep 17 00:00:00 2001 From: Oleksandr Anyshchenko Date: Fri, 10 Feb 2023 11:25:33 +0100 Subject: [PATCH] Check in CI compatibility with MSRV (#741) --- .github/workflows/rust.yml | 8 +++++--- Cargo.toml | 1 + librocksdb-sys/Cargo.toml | 1 + src/transactions/transaction_db.rs | 10 ++++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9fd58b7..cc574a8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,8 @@ name: RocksDB CI on: [push, pull_request] +env: + RUST_VERSION: 1.60.0 jobs: fmt: @@ -12,7 +14,7 @@ jobs: - name: Install rust uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: ${{ env.RUST_VERSION }} components: rustfmt profile: minimal override: true @@ -31,7 +33,7 @@ jobs: - name: Install rust uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: ${{ env.RUST_VERSION }} components: clippy profile: minimal override: true @@ -69,7 +71,7 @@ jobs: - name: Install rust uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.rust || 'stable' }} + toolchain: ${{ env.RUST_VERSION }} target: ${{ matrix.target }} profile: minimal override: true diff --git a/Cargo.toml b/Cargo.toml index 34a70da..5d6be0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "rocksdb" description = "Rust wrapper for Facebook's RocksDB embeddable database" version = "0.20.0" edition = "2018" +rust-version = "1.60" authors = ["Tyler Neely ", "David Greenberg "] repository = "https://github.com/rust-rocksdb/rust-rocksdb" license = "Apache-2.0" diff --git a/librocksdb-sys/Cargo.toml b/librocksdb-sys/Cargo.toml index acbd6c6..d6b1ed0 100644 --- a/librocksdb-sys/Cargo.toml +++ b/librocksdb-sys/Cargo.toml @@ -2,6 +2,7 @@ name = "librocksdb-sys" version = "0.10.0+7.9.2" edition = "2018" +rust-version = "1.60" authors = ["Karl Hobley ", "Arkadiy Paronyan "] license = "MIT/Apache-2.0/BSD-3-Clause" description = "Native bindings to librocksdb" diff --git a/src/transactions/transaction_db.rs b/src/transactions/transaction_db.rs index 92454b4..c4f81d8 100644 --- a/src/transactions/transaction_db.rs +++ b/src/transactions/transaction_db.rs @@ -57,7 +57,7 @@ type DefaultThreadMode = crate::MultiThreaded; /// { /// let db: TransactionDB = TransactionDB::open_default(path).unwrap(); /// db.put(b"my key", b"my value").unwrap(); -/// +/// /// // create transaction /// let txn = db.transaction(); /// txn.put(b"key2", b"value2"); @@ -359,11 +359,9 @@ impl TransactionDB { name: &str, opts: &Options, ) -> Result<*mut ffi::rocksdb_column_family_handle_t, Error> { - let Ok(cf_name) = CString::new(name.as_bytes()) else { - return Err(Error::new( - "Failed to convert path to CString when creating cf".to_owned(), - )); - }; + let cf_name = CString::new(name.as_bytes()).map_err(|_| { + Error::new("Failed to convert path to CString when creating cf".to_owned()) + })?; Ok(unsafe { ffi_try!(ffi::rocksdb_transactiondb_create_column_family(