Uses new cargo lint configuration system

pull/706/head
Tpt 9 months ago committed by Thomas Tanon
parent 4756217787
commit 025bd2afd2
  1. 174
      .cargo/config.toml
  2. 6
      .github/workflows/tests.yml
  3. 184
      Cargo.toml
  4. 3
      cli/Cargo.toml
  5. 3
      js/Cargo.toml
  6. 3
      lib/Cargo.toml
  7. 3
      lib/oxrdf/Cargo.toml
  8. 4
      lib/oxrdf/src/interning.rs
  9. 3
      lib/oxrdfio/Cargo.toml
  10. 3
      lib/oxrdfxml/Cargo.toml
  11. 10
      lib/oxrdfxml/src/parser.rs
  12. 3
      lib/oxsdatatypes/Cargo.toml
  13. 3
      lib/oxsdatatypes/src/date_time.rs
  14. 3
      lib/oxttl/Cargo.toml
  15. 2
      lib/oxttl/src/line_formats.rs
  16. 2
      lib/oxttl/src/n3.rs
  17. 2
      lib/oxttl/src/terse.rs
  18. 3
      lib/sparesults/Cargo.toml
  19. 2
      lib/sparesults/src/json.rs
  20. 2
      lib/sparesults/src/xml.rs
  21. 3
      lib/spargebra/Cargo.toml
  22. 3
      lib/sparopt/Cargo.toml
  23. 3
      lib/sparql-smith/Cargo.toml
  24. 8
      lib/src/sparql/algebra.rs
  25. 2
      lib/src/sparql/model.rs
  26. 1
      lib/src/sparql/service.rs
  27. 26
      lib/src/storage/backend/rocksdb.rs
  28. 7
      lib/src/storage/error.rs
  29. 83
      lints/build_clippy_config.py
  30. 90
      lints/build_config.py
  31. 3
      python/Cargo.toml
  32. 8
      python/src/io.rs
  33. 52
      python/src/model.rs
  34. 8
      python/src/sparql.rs
  35. 4
      python/src/store.rs
  36. 3
      testsuite/Cargo.toml

@ -1,174 +0,0 @@
[build]
rustflags = [
"-Wclippy::allow-attributes",
"-Wclippy::allow-attributes-without-reason",
"-Wclippy::as-underscore",
"-Wclippy::assertions-on-result-states",
"-Wclippy::bool-to-int-with-if",
"-Wclippy::borrow-as-ptr",
"-Wclippy::case-sensitive-file-extension-comparisons",
"-Wclippy::cast-lossless",
"-Wclippy::cast-possible-truncation",
"-Wclippy::cast-possible-wrap",
"-Wclippy::cast-precision-loss",
"-Wclippy::cast-ptr-alignment",
"-Wclippy::cast-sign-loss",
"-Wclippy::checked-conversions",
"-Wclippy::clone-on-ref-ptr",
"-Wclippy::cloned-instead-of-copied",
"-Wclippy::copy-iterator",
"-Wclippy::create-dir",
"-Wclippy::dbg-macro",
"-Wclippy::decimal-literal-representation",
"-Wclippy::default-trait-access",
"-Wclippy::default-union-representation",
"-Wclippy::deref-by-slicing",
"-Wclippy::disallowed-script-idents",
"-Wclippy::doc-link-with-quotes",
"-Wclippy::empty-drop",
"-Wclippy::empty-enum",
"-Wclippy::empty-structs-with-brackets",
"-Wclippy::enum-glob-use",
"-Wclippy::error-impl-error",
"-Wclippy::exit",
"-Wclippy::expect-used",
"-Wclippy::expl-impl-clone-on-copy",
"-Wclippy::explicit-deref-methods",
"-Wclippy::explicit-into-iter-loop",
"-Wclippy::explicit-iter-loop",
"-Wclippy::filetype-is-file",
"-Wclippy::filter-map-next",
"-Wclippy::flat-map-option",
"-Wclippy::fn-params-excessive-bools",
"-Wclippy::fn-to-numeric-cast-any",
"-Wclippy::format-push-string",
"-Wclippy::from-iter-instead-of-collect",
"-Wclippy::get-unwrap",
"-Wclippy::host-endian-bytes",
"-Wclippy::if-not-else",
"-Wclippy::if-then-some-else-none",
"-Wclippy::ignored-unit-patterns",
"-Wclippy::implicit-clone",
"-Wclippy::implicit-hasher",
"-Wclippy::inconsistent-struct-constructor",
"-Wclippy::index-refutable-slice",
"-Wclippy::inefficient-to-string",
"-Wclippy::inline-always",
"-Wclippy::inline-asm-x86-att-syntax",
"-Wclippy::inline-asm-x86-intel-syntax",
"-Wclippy::invalid-upcast-comparisons",
"-Wclippy::items-after-statements",
"-Wclippy::iter-not-returning-iterator",
"-Wclippy::large-digit-groups",
"-Wclippy::large-futures",
"-Wclippy::large-include-file",
"-Wclippy::large-stack-arrays",
"-Wclippy::large-types-passed-by-value",
"-Wclippy::let-underscore-must-use",
"-Wclippy::let-underscore-untyped",
"-Wclippy::linkedlist",
"-Wclippy::lossy-float-literal",
"-Wclippy::macro-use-imports",
"-Wclippy::manual-assert",
"-Wclippy::manual-instant-elapsed",
"-Wclippy::manual-let-else",
"-Wclippy::manual-ok-or",
"-Wclippy::manual-string-new",
"-Wclippy::many-single-char-names",
"-Wclippy::map-unwrap-or",
"-Wclippy::match-bool",
"-Wclippy::match-on-vec-items",
"-Wclippy::match-same-arms",
"-Wclippy::match-wild-err-arm",
"-Wclippy::match-wildcard-for-single-variants",
"-Wclippy::maybe-infinite-iter",
"-Wclippy::mem-forget",
"-Wclippy::mismatching-type-param-order",
"-Wclippy::missing-assert-message",
"-Wclippy::missing-asserts-for-indexing",
"-Wclippy::missing-enforced-import-renames",
"-Wclippy::missing-fields-in-debug",
"-Wclippy::multiple-inherent-impl",
"-Wclippy::mut-mut",
"-Wclippy::mutex-atomic",
"-Wclippy::naive-bytecount",
"-Wclippy::needless-bitwise-bool",
"-Wclippy::needless-continue",
"-Wclippy::needless-for-each",
"-Wclippy::needless-pass-by-value",
"-Wclippy::needless-raw-strings",
"-Wclippy::negative-feature-names",
"-Wclippy::no-effect-underscore-binding",
"-Wclippy::no-mangle-with-rust-abi",
"-Wclippy::non-ascii-literal",
"-Wclippy::panic",
"-Wclippy::panic-in-result-fn",
"-Wclippy::partial-pub-fields",
"-Wclippy::print-stderr",
"-Wclippy::print-stdout",
"-Wclippy::ptr-as-ptr",
"-Wclippy::ptr-cast-constness",
"-Wclippy::pub-without-shorthand",
"-Wclippy::range-minus-one",
"-Wclippy::range-plus-one",
"-Wclippy::rc-buffer",
"-Wclippy::rc-mutex",
"-Wclippy::redundant-closure-for-method-calls",
"-Wclippy::redundant-else",
"-Wclippy::redundant-feature-names",
"-Wclippy::redundant-type-annotations",
"-Wclippy::ref-binding-to-reference",
"-Wclippy::ref-option-ref",
"-Wclippy::ref-patterns",
"-Wclippy::rest-pat-in-fully-bound-structs",
"-Wclippy::return-self-not-must-use",
"-Wclippy::same-functions-in-if-condition",
"-Wclippy::same-name-method",
"-Wclippy::semicolon-inside-block",
"-Wclippy::shadow-same",
"-Wclippy::should-panic-without-expect",
"-Wclippy::single-match-else",
"-Wclippy::stable-sort-primitive",
"-Wclippy::str-to-string",
"-Wclippy::string-add",
"-Wclippy::string-add-assign",
"-Wclippy::string-lit-chars-any",
"-Wclippy::string-to-string",
"-Wclippy::struct-excessive-bools",
"-Wclippy::suspicious-xor-used-as-pow",
"-Wclippy::tests-outside-test-module",
"-Wclippy::todo",
"-Wclippy::transmute-ptr-to-ptr",
"-Wclippy::trivially-copy-pass-by-ref",
"-Wclippy::try-err",
"-Wclippy::unchecked-duration-subtraction",
"-Wclippy::undocumented-unsafe-blocks",
"-Wclippy::unicode-not-nfc",
"-Wclippy::unimplemented",
"-Wclippy::uninlined-format-args",
"-Wclippy::unnecessary-box-returns",
"-Wclippy::unnecessary-join",
"-Wclippy::unnecessary-safety-comment",
"-Wclippy::unnecessary-safety-doc",
"-Wclippy::unnecessary-self-imports",
"-Wclippy::unnecessary-wraps",
"-Wclippy::unneeded-field-pattern",
"-Wclippy::unnested-or-patterns",
"-Wclippy::unreadable-literal",
"-Wclippy::unsafe-derive-deserialize",
"-Wclippy::unseparated-literal-suffix",
"-Wclippy::unused-async",
"-Wclippy::unused-self",
"-Wclippy::unwrap-in-result",
"-Wclippy::use-debug",
"-Wclippy::used-underscore-binding",
"-Wclippy::verbose-bit-mask",
"-Wclippy::verbose-file-reads",
"-Wclippy::wildcard-dependencies",
"-Wclippy::zero-sized-map-values",
"-Wtrivial-casts",
"-Wtrivial-numeric-casts",
"-Wunsafe-code",
"-Wunused-lifetimes",
"-Wunused-qualifications",
]

@ -123,7 +123,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- run: rustup update && rustup toolchain install nightly && rustup default 1.74.1
- run: rustup update && rustup toolchain install nightly && rustup default 1.70.0
- uses: Swatinem/rust-cache@v2
- run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions
- run: cargo test
@ -264,7 +264,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- run: rustup update && rustup toolchain install nightly && rustup default 1.74.1
- run: rustup update && rustup toolchain install nightly && rustup default 1.70.0
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
@ -285,7 +285,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- run: rustup update && rustup toolchain install nightly && rustup default 1.74.1
- run: rustup update
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:

@ -26,9 +26,193 @@ homepage = "https://oxigraph.org/"
edition = "2021"
rust-version = "1.70"
[workspace.lints.rust]
absolute_paths_not_starting_with_crate = "warn"
elided_lifetimes_in_paths = "warn"
explicit_outlives_requirements = "warn"
let_underscore_drop = "warn"
macro_use_extern_crate = "warn"
# TODO missing_docs = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unsafe_code = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_qualifications = "warn"
[workspace.lints.clippy]
allow_attributes = "warn"
allow_attributes_without_reason = "warn"
as_underscore = "warn"
assertions_on_result_states = "warn"
bool_to_int_with_if = "warn"
borrow_as_ptr = "warn"
case_sensitive_file_extension_comparisons = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_precision_loss = "warn"
cast_ptr_alignment = "warn"
cast_sign_loss = "warn"
checked_conversions = "warn"
clone_on_ref_ptr = "warn"
cloned_instead_of_copied = "warn"
copy_iterator = "warn"
create_dir = "warn"
dbg_macro = "warn"
decimal_literal_representation = "warn"
default_trait_access = "warn"
default_union_representation = "warn"
deref_by_slicing = "warn"
disallowed_script_idents = "warn"
doc_link_with_quotes = "warn"
empty_drop = "warn"
empty_enum = "warn"
empty_structs_with_brackets = "warn"
enum_glob_use = "warn"
error_impl_error = "warn"
exit = "warn"
expect_used = "warn"
expl_impl_clone_on_copy = "warn"
explicit_deref_methods = "warn"
explicit_into_iter_loop = "warn"
explicit_iter_loop = "warn"
filetype_is_file = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
fn_params_excessive_bools = "warn"
fn_to_numeric_cast_any = "warn"
format_push_string = "warn"
from_iter_instead_of_collect = "warn"
get_unwrap = "warn"
host_endian_bytes = "warn"
if_not_else = "warn"
if_then_some_else_none = "warn"
ignored_unit_patterns = "warn"
implicit_clone = "warn"
implicit_hasher = "warn"
inconsistent_struct_constructor = "warn"
index_refutable_slice = "warn"
inefficient_to_string = "warn"
inline_always = "warn"
inline_asm_x86_att_syntax = "warn"
inline_asm_x86_intel_syntax = "warn"
invalid_upcast_comparisons = "warn"
items_after_statements = "warn"
iter_not_returning_iterator = "warn"
large_digit_groups = "warn"
large_futures = "warn"
large_include_file = "warn"
large_stack_arrays = "warn"
large_types_passed_by_value = "warn"
let_underscore_must_use = "warn"
let_underscore_untyped = "warn"
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
manual_assert = "warn"
manual_instant_elapsed = "warn"
manual_let_else = "warn"
manual_ok_or = "warn"
manual_string_new = "warn"
many_single_char_names = "warn"
map_unwrap_or = "warn"
match_bool = "warn"
match_on_vec_items = "warn"
match_same_arms = "warn"
match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn"
maybe_infinite_iter = "warn"
mem_forget = "warn"
mismatching_type_param_order = "warn"
missing_assert_message = "warn"
missing_asserts_for_indexing = "warn"
missing_enforced_import_renames = "warn"
missing_fields_in_debug = "warn"
multiple_inherent_impl = "warn"
mut_mut = "warn"
mutex_atomic = "warn"
naive_bytecount = "warn"
needless_bitwise_bool = "warn"
needless_continue = "warn"
needless_for_each = "warn"
needless_pass_by_value = "warn"
needless_raw_strings = "warn"
negative_feature_names = "warn"
no_effect_underscore_binding = "warn"
no_mangle_with_rust_abi = "warn"
non_ascii_literal = "warn"
panic = "warn"
panic_in_result_fn = "warn"
partial_pub_fields = "warn"
print_stderr = "warn"
print_stdout = "warn"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
pub_without_shorthand = "warn"
range_minus_one = "warn"
range_plus_one = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_closure_for_method_calls = "warn"
redundant_else = "warn"
redundant_feature_names = "warn"
redundant_type_annotations = "warn"
ref_binding_to_reference = "warn"
ref_option_ref = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn"
return_self_not_must_use = "warn"
same_functions_in_if_condition = "warn"
same_name_method = "warn"
semicolon_inside_block = "warn"
shadow_same = "warn"
should_panic_without_expect = "warn"
single_match_else = "warn"
stable_sort_primitive = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
string_lit_chars_any = "warn"
string_to_string = "warn"
struct_excessive_bools = "warn"
suspicious_xor_used_as_pow = "warn"
tests_outside_test_module = "warn"
todo = "warn"
transmute_ptr_to_ptr = "warn"
trivially_copy_pass_by_ref = "warn"
try_err = "warn"
unchecked_duration_subtraction = "warn"
undocumented_unsafe_blocks = "warn"
unicode_not_nfc = "warn"
unimplemented = "warn"
uninlined_format_args = "warn"
unnecessary_box_returns = "warn"
unnecessary_join = "warn"
unnecessary_safety_comment = "warn"
unnecessary_safety_doc = "warn"
unnecessary_self_imports = "warn"
unnecessary_wraps = "warn"
unneeded_field_pattern = "warn"
unnested_or_patterns = "warn"
unreadable_literal = "warn"
unsafe_derive_deserialize = "warn"
unseparated_literal_suffix = "warn"
unused_async = "warn"
unused_self = "warn"
unwrap_in_result = "warn"
use_debug = "warn"
used_underscore_binding = "warn"
verbose_bit_mask = "warn"
verbose_file_reads = "warn"
wildcard_dependencies = "warn"
zero_sized_map_values = "warn"
[profile.release]
lto = true
codegen-units = 1
[profile.release.package.oxigraph-js]
opt-level = "z"

@ -41,3 +41,6 @@ assert_cmd = "2.0"
assert_fs = "1.0"
escargot = "0.5"
predicates = ">=2.0, <4.0"
[lints]
workspace = true

@ -20,3 +20,6 @@ oxigraph = { version = "0.4.0-alpha.1-dev", path="../lib", features = ["js"] }
wasm-bindgen = "0.2.83"
js-sys = "0.3.60"
console_error_panic_hook = "0.1.7"
[lints]
workspace = true

@ -58,6 +58,9 @@ criterion = "0.5"
oxhttp = "0.2.0-alpha.3"
zstd = ">=0.12, <0.14"
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -24,6 +24,9 @@ oxilangtag = "0.1"
oxiri = "0.2"
oxsdatatypes = { version = "0.2.0-alpha.1-dev", path="../oxsdatatypes", optional = true }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -101,7 +101,7 @@ impl InternedNamedNode {
})
}
pub fn decode_from(self, interner: &Interner) -> NamedNodeRef {
pub fn decode_from(self, interner: &Interner) -> NamedNodeRef<'_> {
NamedNodeRef::new_unchecked(interner.resolve(self.id))
}
@ -154,7 +154,7 @@ impl InternedBlankNode {
}
}
pub fn decode_from(self, interner: &Interner) -> BlankNodeRef {
pub fn decode_from(self, interner: &Interner) -> BlankNodeRef<'_> {
BlankNodeRef::new_unchecked(match self {
Self::Number { id } => &interner.string_for_blank_node_id[&id],
Self::Other { id } => interner.resolve(id),

@ -28,6 +28,9 @@ tokio = { version = "1.29", optional = true, features = ["io-util"] }
[dev-dependencies]
tokio = { version = "1.29", features = ["rt", "macros"] }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -28,6 +28,9 @@ tokio = { version = "1.29", optional = true, features = ["io-util"] }
[dev-dependencies]
tokio = { version = "1.29", features = ["rt", "macros"] }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -417,7 +417,11 @@ struct RdfXmlReader<R> {
}
impl<R> RdfXmlReader<R> {
fn parse_event(&mut self, event: Event, results: &mut Vec<Triple>) -> Result<(), ParseError> {
fn parse_event(
&mut self,
event: Event<'_>,
results: &mut Vec<Triple>,
) -> Result<(), ParseError> {
match event {
Event::Start(event) => self.parse_start_event(&event, results),
Event::End(event) => self.parse_end_event(&event, results),
@ -902,7 +906,7 @@ impl<R> RdfXmlReader<R> {
fn resolve_ns_name(
&self,
namespace: ResolveResult,
namespace: ResolveResult<'_>,
local_name: LocalName<'_>,
) -> Result<String, ParseError> {
match namespace {
@ -1141,7 +1145,7 @@ impl<R> RdfXmlReader<R> {
}
}
fn convert_attribute(&self, attribute: &Attribute) -> Result<String, ParseError> {
fn convert_attribute(&self, attribute: &Attribute<'_>) -> Result<String, ParseError> {
Ok(attribute
.decode_and_unescape_value_with(&self.reader, |e| self.resolve_entity(e))?
.into_owned())

@ -21,6 +21,9 @@ custom-now = []
[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
js-sys = { version = "0.3.60", optional = true }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -3178,8 +3178,9 @@ mod tests {
#[cfg(feature = "custom-now")]
#[test]
fn custom_now() {
#[allow(unsafe_code)]
#[no_mangle]
fn custom_ox_now() -> Duration {
extern "Rust" fn custom_ox_now() -> Duration {
Duration::default()
}
DateTime::now();

@ -29,6 +29,9 @@ tokio = { version = "1.29", optional = true, features = ["io-util"] }
[dev-dependencies]
tokio = { version = "1.29", features = ["rt", "macros"] }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -53,7 +53,7 @@ impl RuleRecognizer for NQuadsRecognizer {
fn recognize_next(
mut self,
token: N3Token,
token: N3Token<'_>,
context: &mut NQuadsRecognizerContext,
results: &mut Vec<Quad>,
errors: &mut Vec<RuleRecognizerError>,

@ -615,7 +615,7 @@ impl RuleRecognizer for N3Recognizer {
fn recognize_next(
mut self,
token: N3Token,
token: N3Token<'_>,
context: &mut N3RecognizerContext,
results: &mut Vec<N3Quad>,
errors: &mut Vec<RuleRecognizerError>,

@ -45,7 +45,7 @@ impl RuleRecognizer for TriGRecognizer {
fn recognize_next(
mut self,
token: N3Token,
token: N3Token<'_>,
context: &mut TriGRecognizerContext,
results: &mut Vec<Quad>,
errors: &mut Vec<RuleRecognizerError>,

@ -29,6 +29,9 @@ tokio = { version = "1.29", optional = true, features = ["io-util"] }
[dev-dependencies]
tokio = { version = "1.29", features = ["rt", "macros"] }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -100,7 +100,7 @@ impl<W: AsyncWrite + Unpin> ToTokioAsyncWriteJsonSolutionsWriter<W> {
let mut buffer = Vec::with_capacity(48);
let inner = InnerJsonSolutionsWriter::start(&mut buffer, variables);
Self::do_write(&mut writer, buffer).await?;
Ok(Self { writer, inner })
Ok(Self { inner, writer })
}
pub async fn write<'a>(

@ -104,7 +104,7 @@ impl<W: AsyncWrite + Unpin> ToTokioAsyncWriteXmlSolutionsWriter<W> {
let mut buffer = Vec::with_capacity(48);
let inner = InnerXmlSolutionsWriter::start(&mut buffer, variables);
Self::do_write(&mut writer, buffer).await?;
Ok(Self { writer, inner })
Ok(Self { inner, writer })
}
pub async fn write<'a>(

@ -27,6 +27,9 @@ oxiri = "0.2"
oxilangtag = "0.1"
oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -25,6 +25,9 @@ oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" }
rand = "0.8"
spargebra = { version = "0.3.0-alpha.1-dev", path="../spargebra" }
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

@ -20,5 +20,8 @@ limit-offset = ["order"]
order = []
sep-0006 = []
[lints]
workspace = true
[dependencies]
arbitrary = { version = "1.3", features = ["derive"] }

@ -70,7 +70,7 @@ impl FromStr for Query {
}
}
impl<'a> TryFrom<&'a str> for Query {
impl TryFrom<&str> for Query {
type Error = spargebra::ParseError;
fn try_from(query: &str) -> Result<Self, spargebra::ParseError> {
@ -78,7 +78,7 @@ impl<'a> TryFrom<&'a str> for Query {
}
}
impl<'a> TryFrom<&'a String> for Query {
impl TryFrom<&String> for Query {
type Error = spargebra::ParseError;
fn try_from(query: &String) -> Result<Self, spargebra::ParseError> {
@ -163,7 +163,7 @@ impl FromStr for Update {
}
}
impl<'a> TryFrom<&'a str> for Update {
impl TryFrom<&str> for Update {
type Error = spargebra::ParseError;
fn try_from(update: &str) -> Result<Self, spargebra::ParseError> {
@ -171,7 +171,7 @@ impl<'a> TryFrom<&'a str> for Update {
}
}
impl<'a> TryFrom<&'a String> for Update {
impl TryFrom<&String> for Update {
type Error = spargebra::ParseError;
fn try_from(update: &String) -> Result<Self, spargebra::ParseError> {

@ -176,6 +176,8 @@ pub struct QuerySolutionIter {
}
impl QuerySolutionIter {
/// Construct a new iterator of solution from an ordered list of solution variables and an iterator of solution tuples
/// (each tuple using the same ordering as the variable list such that tuple element 0 is the value for the variable 0...)
pub fn new(
variables: Arc<[Variable]>,
iter: impl Iterator<Item = Result<Vec<Option<Term>>, EvaluationError>> + 'static,

@ -49,6 +49,7 @@ use std::time::Duration;
/// # Result::<_,Box<dyn std::error::Error>>::Ok(())
/// ```
pub trait ServiceHandler: Send + Sync {
/// The service evaluation error.
type Error: Error + Send + Sync + 'static;
/// Evaluates a [`Query`] against a given service identified by a [`NamedNode`].

@ -30,24 +30,14 @@ use std::thread::{available_parallelism, yield_now};
use std::{ptr, slice};
macro_rules! ffi_result {
( $($function:ident)::*() ) => {
ffi_result_impl!($($function)::*())
};
( $($function:ident)::*( $arg1:expr $(, $arg:expr)* $(,)? ) ) => {
ffi_result_impl!($($function)::*($arg1 $(, $arg)* ,))
};
}
macro_rules! ffi_result_impl {
( $($function:ident)::*( $($arg:expr,)*) ) => {{
( $($function:ident)::*( $arg1:expr $(, $arg:expr)* $(,)? ) ) => {{
let mut status = rocksdb_status_t {
code: rocksdb_status_code_t_rocksdb_status_code_ok,
subcode: rocksdb_status_subcode_t_rocksdb_status_subcode_none,
severity: rocksdb_status_severity_t_rocksdb_status_severity_none,
string: ptr::null()
};
let result = $($function)::*($($arg,)* &mut status);
let result = $($function)::*($arg1 $(, $arg)* , &mut status);
if status.code == rocksdb_status_code_t_rocksdb_status_code_ok {
Ok(result)
} else {
@ -119,8 +109,7 @@ impl Drop for RwDbHandler {
rocksdb_block_based_options_destroy(self.block_based_table_options);
}
if self.in_memory {
#[allow(clippy::let_underscore_must_use)]
let _: io::Result<()> = remove_dir_all(&self.path);
drop(remove_dir_all(&self.path));
}
}
}
@ -154,8 +143,7 @@ impl Drop for RoDbHandler {
rocksdb_options_destroy(self.options);
}
if let Some(path) = &self.path_to_remove {
#[allow(clippy::let_underscore_must_use)]
let _: io::Result<()> = remove_dir_all(path);
drop(remove_dir_all(path));
}
}
}
@ -571,9 +559,9 @@ impl Db {
DbKind::ReadOnly(db) => {
if db.is_secondary {
// We try to refresh (and ignore the errors)
#[allow(clippy::let_underscore_must_use)]
let _: Result<(), ErrorStatus> =
ffi_result!(rocksdb_try_catch_up_with_primary_with_status(db.db));
drop(ffi_result!(rocksdb_try_catch_up_with_primary_with_status(
db.db
)));
}
let options = rocksdb_readoptions_create_copy(db.read_options);
Reader {

@ -128,7 +128,12 @@ pub enum LoaderError {
/// An error raised during the insertion in the store.
Storage(StorageError),
/// The base IRI is invalid.
InvalidBaseIri { iri: String, error: IriParseError },
InvalidBaseIri {
/// The IRI itself.
iri: String,
/// The parsing error.
error: IriParseError,
},
}
impl fmt::Display for LoaderError {

@ -0,0 +1,83 @@
import json
from pathlib import Path
from urllib.request import urlopen
import tomlkit
MSRV = "1.74.0"
LINT_BLACKLIST = {
"absolute_paths", # TODO: might be nice
"alloc_instead_of_core",
"arithmetic_side_effects", # TODO: might be nice
"as_conversions",
"big_endian_bytes",
"cargo_common_metadata", # TODO: might be nice
"doc_markdown", # Too many false positives
"default_numeric_fallback",
"else_if_without_else",
"exhaustive_enums",
"exhaustive_structs",
"float_arithmetic",
"float_cmp",
"float_cmp_const",
"impl_trait_in_params",
"implicit_return",
"indexing_slicing",
"integer_division",
"little_endian_bytes",
"map_err_ignore",
"min_ident_chars",
"missing_docs_in_private_items",
"missing_errors_doc",
"missing_inline_in_public_items",
"missing_panics_doc",
"missing_trait_methods",
"mixed_read_write_in_expression",
"mod_module_files",
"module_name_repetitions",
"modulo_arithmetic",
"multiple_crate_versions",
"multiple_unsafe_ops_per_block",
"must_use_candidate", # TODO: might be nice
"option_option",
"pattern_type_mismatch",
"pub_use",
"pub_with_shorthand",
"question_mark_used",
"self_named_module_files", # TODO: might be nice
"semicolon_if_nothing_returned", # TODO: might be nice
"semicolon_outside_block",
"similar_names",
"single_call_fn",
"single_char_lifetime_names",
"std_instead_of_alloc",
"std_instead_of_core",
"shadow_reuse",
"shadow_unrelated",
"string_slice", # TODO: might be nice
"too_many_lines",
"separated_literal_suffix",
"unreachable", # TODO: might be nice
"unwrap_used", # TODO: might be nice to use expect instead
"wildcard_enum_match_arm", # TODO: might be nice
"wildcard_imports", # TODO: might be nice
}
lints = set()
with urlopen(
f"https://rust-lang.github.io/rust-clippy/rust-{MSRV}/lints.json"
) as response:
for lint in json.load(response):
if lint["level"] == "allow" and lint["group"] != "nursery":
lints.add(lint["id"])
for flag in LINT_BLACKLIST:
if flag in lints:
lints.remove(flag)
else:
print(f"Unused blacklisted flag: {flag}")
cargo_path = Path(__file__).parent.parent / "Cargo.toml"
cargo_toml = tomlkit.parse(cargo_path.read_text())
cargo_toml["workspace"]["lints"]["clippy"] = {lint: "warn" for lint in sorted(lints)}
cargo_path.write_text(tomlkit.dumps(cargo_toml))

@ -1,90 +0,0 @@
import json
from pathlib import Path
from urllib.request import urlopen
MSRV = "1.74.0"
DEFAULT_BUILD_FLAGS = {
"-Wtrivial-casts",
"-Wtrivial-numeric-casts",
"-Wunsafe-code",
"-Wunused-lifetimes",
"-Wunused-qualifications",
}
FLAGS_BLACKLIST = {
"-Wclippy::absolute-paths", # TODO: might be nice
"-Wclippy::alloc-instead-of-core",
"-Wclippy::arithmetic-side-effects", # TODO: might be nice
"-Wclippy::as-conversions",
"-Wclippy::big-endian-bytes",
"-Wclippy::cargo-common-metadata", # TODO: might be nice
"-Wclippy::doc-markdown", # Too many false positives
"-Wclippy::default-numeric-fallback",
"-Wclippy::else-if-without-else",
"-Wclippy::exhaustive-enums",
"-Wclippy::exhaustive-structs",
"-Wclippy::float-arithmetic",
"-Wclippy::float-cmp",
"-Wclippy::float-cmp-const",
"-Wclippy::impl-trait-in-params",
"-Wclippy::implicit-return",
"-Wclippy::indexing-slicing",
"-Wclippy::integer-division",
"-Wclippy::little-endian-bytes",
"-Wclippy::map-err-ignore",
"-Wclippy::min-ident-chars",
"-Wclippy::missing-docs-in-private-items",
"-Wclippy::missing-errors-doc",
"-Wclippy::missing-inline-in-public-items",
"-Wclippy::missing-panics-doc",
"-Wclippy::missing-trait-methods",
"-Wclippy::mixed-read-write-in-expression",
"-Wclippy::mod-module-files",
"-Wclippy::module-name-repetitions",
"-Wclippy::modulo-arithmetic",
"-Wclippy::multiple-crate-versions",
"-Wclippy::multiple-unsafe-ops-per-block",
"-Wclippy::must-use-candidate", # TODO: might be nice
"-Wclippy::option-option",
"-Wclippy::pattern-type-mismatch",
"-Wclippy::pub-use",
"-Wclippy::pub-with-shorthand",
"-Wclippy::question-mark-used",
"-Wclippy::self-named-module-files", # TODO: might be nice
"-Wclippy::semicolon-if-nothing-returned", # TODO: might be nice
"-Wclippy::semicolon-outside-block",
"-Wclippy::similar-names",
"-Wclippy::single-call-fn",
"-Wclippy::single-char-lifetime-names",
"-Wclippy::std-instead-of-alloc",
"-Wclippy::std-instead-of-core",
"-Wclippy::shadow-reuse",
"-Wclippy::shadow-unrelated",
"-Wclippy::string-slice", # TODO: might be nice
"-Wclippy::too-many-lines",
"-Wclippy::separated-literal-suffix",
"-Wclippy::unreachable", # TODO: might be nice
"-Wclippy::unwrap-used", # TODO: might be nice to use expect instead
"-Wclippy::wildcard-enum-match-arm", # TODO: might be nice
"-Wclippy::wildcard-imports", # TODO: might be nice
}
build_flags = set(DEFAULT_BUILD_FLAGS)
with urlopen(
f"https://rust-lang.github.io/rust-clippy/rust-{MSRV}/lints.json"
) as response:
for lint in json.load(response):
if lint["level"] == "allow" and lint["group"] != "nursery":
build_flags.add(f"-Wclippy::{lint['id'].replace('_', '-')}")
for flag in FLAGS_BLACKLIST:
if flag in build_flags:
build_flags.remove(flag)
else:
print(f"Unused blacklisted flag: {flag}")
with (Path(__file__).parent.parent / ".cargo" / "config.toml").open("wt") as fp:
fp.write("[build]\n")
fp.write("rustflags = [\n")
for flag in sorted(build_flags):
fp.write(f' "{flag}",\n')
fp.write("]\n")

@ -27,3 +27,6 @@ rustls = ["oxigraph/http-client-rustls-native"]
[dependencies]
oxigraph = { version = "0.4.0-alpha.1-dev", path="../lib" }
pyo3 = { version = "0.20", features = ["extension-module"] }
[lints]
workspace = true

@ -129,10 +129,10 @@ pub fn serialize<'a>(
let mut writer = RdfSerializer::from_format(format).serialize_to_write(output);
for i in input.iter()? {
let i = i?;
if let Ok(triple) = i.extract::<PyRef<PyTriple>>() {
if let Ok(triple) = i.extract::<PyRef<'_, PyTriple>>() {
writer.write_triple(&*triple)
} else {
let quad = i.extract::<PyRef<PyQuad>>()?;
let quad = i.extract::<PyRef<'_, PyQuad>>()?;
let quad = QuadRef::from(&*quad);
if !quad.graph_name.is_default_graph() && !format.supports_datasets() {
return Err(PyValueError::new_err(
@ -157,7 +157,7 @@ pub struct PyQuadReader {
#[pymethods]
impl PyQuadReader {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -348,7 +348,7 @@ impl PyRdfFormat {
}
/// :rtype: RdfFormat
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}

@ -96,7 +96,7 @@ impl PyNamedNode {
}
fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult<bool> {
if let Ok(other) = other.extract::<PyRef<Self>>() {
if let Ok(other) = other.extract::<PyRef<'_, Self>>() {
Ok(op.matches(self.cmp(&other)))
} else if PyBlankNode::is_type_of(other)
|| PyLiteral::is_type_of(other)
@ -116,7 +116,7 @@ impl PyNamedNode {
}
/// :rtype: NamedNode
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -223,7 +223,7 @@ impl PyBlankNode {
}
fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult<bool> {
if let Ok(other) = other.extract::<PyRef<Self>>() {
if let Ok(other) = other.extract::<PyRef<'_, Self>>() {
eq_compare(self, &other, op)
} else if PyNamedNode::is_type_of(other)
|| PyLiteral::is_type_of(other)
@ -243,7 +243,7 @@ impl PyBlankNode {
}
/// :rtype: BlankNode
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -380,7 +380,7 @@ impl PyLiteral {
}
fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult<bool> {
if let Ok(other) = other.extract::<PyRef<Self>>() {
if let Ok(other) = other.extract::<PyRef<'_, Self>>() {
eq_compare(self, &other, op)
} else if PyNamedNode::is_type_of(other)
|| PyBlankNode::is_type_of(other)
@ -406,7 +406,7 @@ impl PyLiteral {
}
/// :rtype: Literal
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -454,7 +454,7 @@ impl PyDefaultGraph {
}
fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult<bool> {
if let Ok(other) = other.extract::<PyRef<Self>>() {
if let Ok(other) = other.extract::<PyRef<'_, Self>>() {
eq_compare(self, &other, op)
} else if PyNamedNode::is_type_of(other)
|| PyBlankNode::is_type_of(other)
@ -474,7 +474,7 @@ impl PyDefaultGraph {
}
/// :rtype: DefaultGraph
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -735,7 +735,7 @@ impl PyTriple {
}
/// :rtype: Triple
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -972,7 +972,7 @@ impl PyQuad {
}
/// :rtype: Quad
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -1064,7 +1064,7 @@ impl PyVariable {
}
/// :rtype: Variable
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -1093,7 +1093,7 @@ impl<'a> TryFrom<&'a PyAny> for PyNamedNodeRef<'a> {
type Error = PyErr;
fn try_from(value: &'a PyAny) -> PyResult<Self> {
if let Ok(node) = value.extract::<PyRef<PyNamedNode>>() {
if let Ok(node) = value.extract::<PyRef<'_, PyNamedNode>>() {
Ok(Self(node))
} else {
Err(PyTypeError::new_err(format!(
@ -1122,9 +1122,9 @@ impl<'a> TryFrom<&'a PyAny> for PyNamedOrBlankNodeRef<'a> {
type Error = PyErr;
fn try_from(value: &'a PyAny) -> PyResult<Self> {
if let Ok(node) = value.extract::<PyRef<PyNamedNode>>() {
if let Ok(node) = value.extract::<PyRef<'_, PyNamedNode>>() {
Ok(Self::NamedNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyBlankNode>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyBlankNode>>() {
Ok(Self::BlankNode(node))
} else {
Err(PyTypeError::new_err(format!(
@ -1155,11 +1155,11 @@ impl<'a> TryFrom<&'a PyAny> for PySubjectRef<'a> {
type Error = PyErr;
fn try_from(value: &'a PyAny) -> PyResult<Self> {
if let Ok(node) = value.extract::<PyRef<PyNamedNode>>() {
if let Ok(node) = value.extract::<PyRef<'_, PyNamedNode>>() {
Ok(Self::NamedNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyBlankNode>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyBlankNode>>() {
Ok(Self::BlankNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyTriple>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyTriple>>() {
Ok(Self::Triple(node))
} else {
Err(PyTypeError::new_err(format!(
@ -1198,13 +1198,13 @@ impl<'a> TryFrom<&'a PyAny> for PyTermRef<'a> {
type Error = PyErr;
fn try_from(value: &'a PyAny) -> PyResult<Self> {
if let Ok(node) = value.extract::<PyRef<PyNamedNode>>() {
if let Ok(node) = value.extract::<PyRef<'_, PyNamedNode>>() {
Ok(Self::NamedNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyBlankNode>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyBlankNode>>() {
Ok(Self::BlankNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyLiteral>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyLiteral>>() {
Ok(Self::Literal(node))
} else if let Ok(node) = value.extract::<PyRef<PyTriple>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyTriple>>() {
Ok(Self::Triple(node))
} else {
Err(PyTypeError::new_err(format!(
@ -1241,11 +1241,11 @@ impl<'a> TryFrom<&'a PyAny> for PyGraphNameRef<'a> {
type Error = PyErr;
fn try_from(value: &'a PyAny) -> PyResult<Self> {
if let Ok(node) = value.extract::<PyRef<PyNamedNode>>() {
if let Ok(node) = value.extract::<PyRef<'_, PyNamedNode>>() {
Ok(Self::NamedNode(node))
} else if let Ok(node) = value.extract::<PyRef<PyBlankNode>>() {
} else if let Ok(node) = value.extract::<PyRef<'_, PyBlankNode>>() {
Ok(Self::BlankNode(node))
} else if value.extract::<PyRef<PyDefaultGraph>>().is_ok() {
} else if value.extract::<PyRef<'_, PyDefaultGraph>>().is_ok() {
Ok(Self::DefaultGraph)
} else {
Err(PyTypeError::new_err(format!(
@ -1341,7 +1341,7 @@ pub struct TripleComponentsIter {
#[pymethods]
impl TripleComponentsIter {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -1357,7 +1357,7 @@ pub struct QuadComponentsIter {
#[pymethods]
impl QuadComponentsIter {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}

@ -164,7 +164,7 @@ pub struct SolutionValueIter {
#[pymethods]
impl SolutionValueIter {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -278,7 +278,7 @@ impl PyQuerySolutions {
)
}
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -435,7 +435,7 @@ impl PyQueryTriples {
)
}
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -637,7 +637,7 @@ impl PyQueryResultsFormat {
}
/// :rtype: QueryResultsFormat
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}

@ -767,7 +767,7 @@ pub struct QuadIter {
#[pymethods]
impl QuadIter {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}
@ -786,7 +786,7 @@ pub struct GraphNameIter {
#[pymethods]
impl GraphNameIter {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<Self> {
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
slf
}

@ -25,6 +25,9 @@ criterion = "0.5"
rio_api = "0.8"
rio_turtle = "0.8"
[lints]
workspace = true
[[bench]]
name = "parser"
harness = false
Loading…
Cancel
Save