CI: Uses 1.76.0 for Clippy

pull/803/head
Tpt 10 months ago committed by Thomas Tanon
parent 7d45ea43f5
commit accadaac34
  1. 12
      .github/workflows/tests.yml
  2. 6
      Cargo.toml
  3. 26
      lib/oxigraph/src/storage/backend/rocksdb.rs
  4. 24
      lib/oxigraph/src/store.rs
  5. 3
      lib/oxrdf/src/parser.rs
  6. 3
      lints/build_clippy_config.py

@ -30,7 +30,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
component: clippy component: clippy
- run: cargo clippy --all-targets -- -D warnings -D clippy::all - run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxsdatatypes working-directory: ./lib/oxsdatatypes
@ -69,7 +69,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
target: wasm32-unknown-unknown target: wasm32-unknown-unknown
component: clippy component: clippy
- run: cargo clippy --lib --tests --target wasm32-unknown-unknown -- -D warnings -D clippy::all - run: cargo clippy --lib --tests --target wasm32-unknown-unknown -- -D warnings -D clippy::all
@ -83,7 +83,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
target: wasm32-wasi target: wasm32-wasi
component: clippy component: clippy
- run: cargo clippy --lib --tests --target wasm32-wasi -- -D warnings -D clippy::all - run: cargo clippy --lib --tests --target wasm32-wasi -- -D warnings -D clippy::all
@ -99,7 +99,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
target: wasm32-unknown-emscripten target: wasm32-unknown-emscripten
component: clippy component: clippy
- run: cargo clippy --lib --tests --target wasm32-unknown-emscripten -- -D warnings -D clippy::all - run: cargo clippy --lib --tests --target wasm32-unknown-emscripten -- -D warnings -D clippy::all
@ -115,7 +115,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
target: wasm32-unknown-unknown target: wasm32-unknown-unknown
component: clippy component: clippy
- run: cargo clippy --lib --tests --target wasm32-unknown-unknown --features getrandom/custom --features oxsdatatypes/custom-now -- -D warnings -D clippy::all - run: cargo clippy --lib --tests --target wasm32-unknown-unknown --features getrandom/custom --features oxsdatatypes/custom-now -- -D warnings -D clippy::all
@ -249,7 +249,7 @@ jobs:
submodules: true submodules: true
- uses: ./.github/actions/setup-rust - uses: ./.github/actions/setup-rust
with: with:
version: 1.74.1 version: 1.76.0
- run: cargo doc - run: cargo doc
env: env:
RUSTDOCFLAGS: -D warnings RUSTDOCFLAGS: -D warnings

@ -149,12 +149,15 @@ implicit_hasher = "warn"
inconsistent_struct_constructor = "warn" inconsistent_struct_constructor = "warn"
index_refutable_slice = "warn" index_refutable_slice = "warn"
inefficient_to_string = "warn" inefficient_to_string = "warn"
infinite_loop = "warn"
inline_always = "warn" inline_always = "warn"
inline_asm_x86_att_syntax = "warn" inline_asm_x86_att_syntax = "warn"
inline_asm_x86_intel_syntax = "warn" inline_asm_x86_intel_syntax = "warn"
into_iter_without_iter = "warn"
invalid_upcast_comparisons = "warn" invalid_upcast_comparisons = "warn"
items_after_statements = "warn" items_after_statements = "warn"
iter_not_returning_iterator = "warn" iter_not_returning_iterator = "warn"
iter_without_into_iter = "warn"
large_digit_groups = "warn" large_digit_groups = "warn"
large_futures = "warn" large_futures = "warn"
large_include_file = "warn" large_include_file = "warn"
@ -182,7 +185,6 @@ mem_forget = "warn"
mismatching_type_param_order = "warn" mismatching_type_param_order = "warn"
missing_assert_message = "warn" missing_assert_message = "warn"
missing_asserts_for_indexing = "warn" missing_asserts_for_indexing = "warn"
missing_enforced_import_renames = "warn"
missing_fields_in_debug = "warn" missing_fields_in_debug = "warn"
multiple_inherent_impl = "warn" multiple_inherent_impl = "warn"
mut_mut = "warn" mut_mut = "warn"
@ -192,6 +194,7 @@ needless_bitwise_bool = "warn"
needless_continue = "warn" needless_continue = "warn"
needless_for_each = "warn" needless_for_each = "warn"
needless_pass_by_value = "warn" needless_pass_by_value = "warn"
needless_raw_string_hashes = "warn"
needless_raw_strings = "warn" needless_raw_strings = "warn"
negative_feature_names = "warn" negative_feature_names = "warn"
no_effect_underscore_binding = "warn" no_effect_underscore_binding = "warn"
@ -231,6 +234,7 @@ string_add_assign = "warn"
string_lit_chars_any = "warn" string_lit_chars_any = "warn"
string_to_string = "warn" string_to_string = "warn"
struct_excessive_bools = "warn" struct_excessive_bools = "warn"
struct_field_names = "warn"
suspicious_xor_used_as_pow = "warn" suspicious_xor_used_as_pow = "warn"
tests_outside_test_module = "warn" tests_outside_test_module = "warn"
todo = "warn" todo = "warn"

@ -614,7 +614,7 @@ impl Db {
(options, snapshot) (options, snapshot)
}; };
let result = f(Transaction { let result = f(Transaction {
transaction: Rc::new(transaction), inner: Rc::new(transaction),
read_options, read_options,
_lifetime: PhantomData, _lifetime: PhantomData,
}); });
@ -1033,7 +1033,7 @@ impl Reader {
} }
let is_currently_valid = rocksdb_iter_valid(iter) != 0; let is_currently_valid = rocksdb_iter_valid(iter) != 0;
Ok(Iter { Ok(Iter {
iter, inner: iter,
options, options,
_upper_bound: upper_bound, _upper_bound: upper_bound,
_reader: self.clone(), _reader: self.clone(),
@ -1061,7 +1061,7 @@ impl Reader {
} }
pub struct Transaction<'a> { pub struct Transaction<'a> {
transaction: Rc<*mut rocksdb_transaction_t>, inner: Rc<*mut rocksdb_transaction_t>,
read_options: *mut rocksdb_readoptions_t, read_options: *mut rocksdb_readoptions_t,
_lifetime: PhantomData<&'a ()>, _lifetime: PhantomData<&'a ()>,
} }
@ -1069,7 +1069,7 @@ pub struct Transaction<'a> {
impl Transaction<'_> { impl Transaction<'_> {
pub fn reader(&self) -> Reader { pub fn reader(&self) -> Reader {
Reader { Reader {
inner: InnerReader::Transaction(Rc::downgrade(&self.transaction)), inner: InnerReader::Transaction(Rc::downgrade(&self.inner)),
options: unsafe { rocksdb_readoptions_create_copy(self.read_options) }, options: unsafe { rocksdb_readoptions_create_copy(self.read_options) },
} }
} }
@ -1081,7 +1081,7 @@ impl Transaction<'_> {
) -> Result<Option<PinnableSlice>, StorageError> { ) -> Result<Option<PinnableSlice>, StorageError> {
unsafe { unsafe {
let slice = ffi_result!(rocksdb_transaction_get_for_update_pinned_cf_with_status( let slice = ffi_result!(rocksdb_transaction_get_for_update_pinned_cf_with_status(
*self.transaction, *self.inner,
self.read_options, self.read_options,
column_family.0, column_family.0,
key.as_ptr().cast(), key.as_ptr().cast(),
@ -1111,7 +1111,7 @@ impl Transaction<'_> {
) -> Result<(), StorageError> { ) -> Result<(), StorageError> {
unsafe { unsafe {
ffi_result!(rocksdb_transaction_put_cf_with_status( ffi_result!(rocksdb_transaction_put_cf_with_status(
*self.transaction, *self.inner,
column_family.0, column_family.0,
key.as_ptr().cast(), key.as_ptr().cast(),
key.len(), key.len(),
@ -1133,7 +1133,7 @@ impl Transaction<'_> {
pub fn remove(&mut self, column_family: &ColumnFamily, key: &[u8]) -> Result<(), StorageError> { pub fn remove(&mut self, column_family: &ColumnFamily, key: &[u8]) -> Result<(), StorageError> {
unsafe { unsafe {
ffi_result!(rocksdb_transaction_delete_cf_with_status( ffi_result!(rocksdb_transaction_delete_cf_with_status(
*self.transaction, *self.inner,
column_family.0, column_family.0,
key.as_ptr().cast(), key.as_ptr().cast(),
key.len(), key.len(),
@ -1223,7 +1223,7 @@ impl From<Buffer> for Vec<u8> {
} }
pub struct Iter { pub struct Iter {
iter: *mut rocksdb_iterator_t, inner: *mut rocksdb_iterator_t,
is_currently_valid: bool, is_currently_valid: bool,
_upper_bound: Option<Vec<u8>>, _upper_bound: Option<Vec<u8>>,
_reader: Reader, // needed to ensure that DB still lives while iter is used _reader: Reader, // needed to ensure that DB still lives while iter is used
@ -1233,7 +1233,7 @@ pub struct Iter {
impl Drop for Iter { impl Drop for Iter {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
rocksdb_iter_destroy(self.iter); rocksdb_iter_destroy(self.inner);
rocksdb_readoptions_destroy(self.options); rocksdb_readoptions_destroy(self.options);
} }
} }
@ -1251,15 +1251,15 @@ impl Iter {
pub fn status(&self) -> Result<(), StorageError> { pub fn status(&self) -> Result<(), StorageError> {
unsafe { unsafe {
ffi_result!(rocksdb_iter_get_status(self.iter))?; ffi_result!(rocksdb_iter_get_status(self.inner))?;
} }
Ok(()) Ok(())
} }
pub fn next(&mut self) { pub fn next(&mut self) {
unsafe { unsafe {
rocksdb_iter_next(self.iter); rocksdb_iter_next(self.inner);
self.is_currently_valid = rocksdb_iter_valid(self.iter) != 0; self.is_currently_valid = rocksdb_iter_valid(self.inner) != 0;
} }
} }
@ -1267,7 +1267,7 @@ impl Iter {
if self.is_valid() { if self.is_valid() {
unsafe { unsafe {
let mut len = 0; let mut len = 0;
let val = rocksdb_iter_key(self.iter, &mut len); let val = rocksdb_iter_key(self.inner, &mut len);
Some(slice::from_raw_parts(val.cast(), len)) Some(slice::from_raw_parts(val.cast(), len))
} }
} else { } else {

@ -688,7 +688,7 @@ impl Store {
return Err(SerializerError::DatasetFormatExpected(serializer.format())); return Err(SerializerError::DatasetFormatExpected(serializer.format()));
} }
let mut writer = serializer.serialize_to_write(write); let mut writer = serializer.serialize_to_write(write);
for quad in self.iter() { for quad in self {
writer.write_quad(&quad?)?; writer.write_quad(&quad?)?;
} }
Ok(writer.finish()?) Ok(writer.finish()?)
@ -1007,13 +1007,23 @@ impl Store {
impl fmt::Display for Store { impl fmt::Display for Store {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for t in self.iter() { for t in self {
writeln!(f, "{} .", t.map_err(|_| fmt::Error)?)?; writeln!(f, "{} .", t.map_err(|_| fmt::Error)?)?;
} }
Ok(()) Ok(())
} }
} }
impl IntoIterator for &Store {
type IntoIter = QuadIter;
type Item = Result<Quad, StorageError>;
#[inline]
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
/// An object to do operations during a transaction. /// An object to do operations during a transaction.
/// ///
/// See [`Store::transaction`] for a more detailed description. /// See [`Store::transaction`] for a more detailed description.
@ -1514,6 +1524,16 @@ impl<'a> Transaction<'a> {
} }
} }
impl IntoIterator for &Transaction<'_> {
type IntoIter = QuadIter;
type Item = Result<Quad, StorageError>;
#[inline]
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
/// An iterator returning the quads contained in a [`Store`]. /// An iterator returning the quads contained in a [`Store`].
pub struct QuadIter { pub struct QuadIter {
iter: ChainedDecodingQuadIterator, iter: ChainedDecodingQuadIterator,

@ -445,7 +445,8 @@ impl TermParseError {
} }
} }
#[cfg(all(test, feature = "rdf-star"))] #[cfg(test)]
#[cfg(feature = "rdf-star")]
mod tests { mod tests {
use super::*; use super::*;

@ -4,7 +4,7 @@ from urllib.request import urlopen
import tomlkit import tomlkit
MSRV = "1.74.0" MSRV = "1.76.0"
LINT_BLACKLIST = { LINT_BLACKLIST = {
"absolute_paths", # TODO: might be nice "absolute_paths", # TODO: might be nice
"alloc_instead_of_core", "alloc_instead_of_core",
@ -24,6 +24,7 @@ LINT_BLACKLIST = {
"implicit_return", "implicit_return",
"indexing_slicing", "indexing_slicing",
"integer_division", "integer_division",
"iter_over_hash_type",
"little_endian_bytes", "little_endian_bytes",
"map_err_ignore", "map_err_ignore",
"min_ident_chars", "min_ident_chars",

Loading…
Cancel
Save