From 025bd2afd2fdd0ba37be0d2e93f7a0c530561955 Mon Sep 17 00:00:00 2001 From: Tpt Date: Fri, 29 Dec 2023 21:22:19 +0100 Subject: [PATCH] Uses new cargo lint configuration system --- .cargo/config.toml | 174 --------------------------- .github/workflows/tests.yml | 6 +- Cargo.toml | 184 +++++++++++++++++++++++++++++ cli/Cargo.toml | 3 + js/Cargo.toml | 3 + lib/Cargo.toml | 3 + lib/oxrdf/Cargo.toml | 3 + lib/oxrdf/src/interning.rs | 4 +- lib/oxrdfio/Cargo.toml | 3 + lib/oxrdfxml/Cargo.toml | 3 + lib/oxrdfxml/src/parser.rs | 10 +- lib/oxsdatatypes/Cargo.toml | 3 + lib/oxsdatatypes/src/date_time.rs | 3 +- lib/oxttl/Cargo.toml | 3 + lib/oxttl/src/line_formats.rs | 2 +- lib/oxttl/src/n3.rs | 2 +- lib/oxttl/src/terse.rs | 2 +- lib/sparesults/Cargo.toml | 3 + lib/sparesults/src/json.rs | 2 +- lib/sparesults/src/xml.rs | 2 +- lib/spargebra/Cargo.toml | 3 + lib/sparopt/Cargo.toml | 3 + lib/sparql-smith/Cargo.toml | 3 + lib/src/sparql/algebra.rs | 8 +- lib/src/sparql/model.rs | 2 + lib/src/sparql/service.rs | 1 + lib/src/storage/backend/rocksdb.rs | 26 ++-- lib/src/storage/error.rs | 7 +- lints/build_clippy_config.py | 83 +++++++++++++ lints/build_config.py | 90 -------------- python/Cargo.toml | 3 + python/src/io.rs | 8 +- python/src/model.rs | 52 ++++---- python/src/sparql.rs | 8 +- python/src/store.rs | 4 +- testsuite/Cargo.toml | 3 + 36 files changed, 384 insertions(+), 338 deletions(-) delete mode 100644 .cargo/config.toml create mode 100644 lints/build_clippy_config.py delete mode 100644 lints/build_config.py diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index dad85ce3..00000000 --- a/.cargo/config.toml +++ /dev/null @@ -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", -] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ce2c3b0..ee5f4f9b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: diff --git a/Cargo.toml b/Cargo.toml index 8264afa9..be87aaac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" + diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0e3e4471..f60ce1ca 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -41,3 +41,6 @@ assert_cmd = "2.0" assert_fs = "1.0" escargot = "0.5" predicates = ">=2.0, <4.0" + +[lints] +workspace = true diff --git a/js/Cargo.toml b/js/Cargo.toml index bfc2ffd5..41f1d0ef 100644 --- a/js/Cargo.toml +++ b/js/Cargo.toml @@ -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 diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 39a0661d..dbb7f599 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -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"] diff --git a/lib/oxrdf/Cargo.toml b/lib/oxrdf/Cargo.toml index a61523a3..2196bc9a 100644 --- a/lib/oxrdf/Cargo.toml +++ b/lib/oxrdf/Cargo.toml @@ -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"] \ No newline at end of file diff --git a/lib/oxrdf/src/interning.rs b/lib/oxrdf/src/interning.rs index e647c26b..ef436149 100644 --- a/lib/oxrdf/src/interning.rs +++ b/lib/oxrdf/src/interning.rs @@ -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), diff --git a/lib/oxrdfio/Cargo.toml b/lib/oxrdfio/Cargo.toml index 45683a5e..0c14f9fa 100644 --- a/lib/oxrdfio/Cargo.toml +++ b/lib/oxrdfio/Cargo.toml @@ -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"] diff --git a/lib/oxrdfxml/Cargo.toml b/lib/oxrdfxml/Cargo.toml index 660a631d..bc5e8993 100644 --- a/lib/oxrdfxml/Cargo.toml +++ b/lib/oxrdfxml/Cargo.toml @@ -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"] diff --git a/lib/oxrdfxml/src/parser.rs b/lib/oxrdfxml/src/parser.rs index f13bbbd4..ebbe80d1 100644 --- a/lib/oxrdfxml/src/parser.rs +++ b/lib/oxrdfxml/src/parser.rs @@ -417,7 +417,11 @@ struct RdfXmlReader { } impl RdfXmlReader { - fn parse_event(&mut self, event: Event, results: &mut Vec) -> Result<(), ParseError> { + fn parse_event( + &mut self, + event: Event<'_>, + results: &mut Vec, + ) -> 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 RdfXmlReader { fn resolve_ns_name( &self, - namespace: ResolveResult, + namespace: ResolveResult<'_>, local_name: LocalName<'_>, ) -> Result { match namespace { @@ -1141,7 +1145,7 @@ impl RdfXmlReader { } } - fn convert_attribute(&self, attribute: &Attribute) -> Result { + fn convert_attribute(&self, attribute: &Attribute<'_>) -> Result { Ok(attribute .decode_and_unescape_value_with(&self.reader, |e| self.resolve_entity(e))? .into_owned()) diff --git a/lib/oxsdatatypes/Cargo.toml b/lib/oxsdatatypes/Cargo.toml index 10f9f4f2..46eeaa20 100644 --- a/lib/oxsdatatypes/Cargo.toml +++ b/lib/oxsdatatypes/Cargo.toml @@ -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"] diff --git a/lib/oxsdatatypes/src/date_time.rs b/lib/oxsdatatypes/src/date_time.rs index c7a1c16a..3c21cf43 100644 --- a/lib/oxsdatatypes/src/date_time.rs +++ b/lib/oxsdatatypes/src/date_time.rs @@ -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(); diff --git a/lib/oxttl/Cargo.toml b/lib/oxttl/Cargo.toml index 98b583bf..eeeb10a3 100644 --- a/lib/oxttl/Cargo.toml +++ b/lib/oxttl/Cargo.toml @@ -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"] diff --git a/lib/oxttl/src/line_formats.rs b/lib/oxttl/src/line_formats.rs index 8c22c1f8..ec439a57 100644 --- a/lib/oxttl/src/line_formats.rs +++ b/lib/oxttl/src/line_formats.rs @@ -53,7 +53,7 @@ impl RuleRecognizer for NQuadsRecognizer { fn recognize_next( mut self, - token: N3Token, + token: N3Token<'_>, context: &mut NQuadsRecognizerContext, results: &mut Vec, errors: &mut Vec, diff --git a/lib/oxttl/src/n3.rs b/lib/oxttl/src/n3.rs index c4f02613..ac6d0388 100644 --- a/lib/oxttl/src/n3.rs +++ b/lib/oxttl/src/n3.rs @@ -615,7 +615,7 @@ impl RuleRecognizer for N3Recognizer { fn recognize_next( mut self, - token: N3Token, + token: N3Token<'_>, context: &mut N3RecognizerContext, results: &mut Vec, errors: &mut Vec, diff --git a/lib/oxttl/src/terse.rs b/lib/oxttl/src/terse.rs index ecce10b6..46dcd740 100644 --- a/lib/oxttl/src/terse.rs +++ b/lib/oxttl/src/terse.rs @@ -45,7 +45,7 @@ impl RuleRecognizer for TriGRecognizer { fn recognize_next( mut self, - token: N3Token, + token: N3Token<'_>, context: &mut TriGRecognizerContext, results: &mut Vec, errors: &mut Vec, diff --git a/lib/sparesults/Cargo.toml b/lib/sparesults/Cargo.toml index fcc95b39..e13b22f5 100644 --- a/lib/sparesults/Cargo.toml +++ b/lib/sparesults/Cargo.toml @@ -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"] diff --git a/lib/sparesults/src/json.rs b/lib/sparesults/src/json.rs index cbaa873c..85b03fcd 100644 --- a/lib/sparesults/src/json.rs +++ b/lib/sparesults/src/json.rs @@ -100,7 +100,7 @@ impl ToTokioAsyncWriteJsonSolutionsWriter { 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>( diff --git a/lib/sparesults/src/xml.rs b/lib/sparesults/src/xml.rs index 808c0f8c..3c2d91a8 100644 --- a/lib/sparesults/src/xml.rs +++ b/lib/sparesults/src/xml.rs @@ -104,7 +104,7 @@ impl ToTokioAsyncWriteXmlSolutionsWriter { 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>( diff --git a/lib/spargebra/Cargo.toml b/lib/spargebra/Cargo.toml index cfc2e8cb..42a14b20 100644 --- a/lib/spargebra/Cargo.toml +++ b/lib/spargebra/Cargo.toml @@ -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"] diff --git a/lib/sparopt/Cargo.toml b/lib/sparopt/Cargo.toml index 586388bd..845209ba 100644 --- a/lib/sparopt/Cargo.toml +++ b/lib/sparopt/Cargo.toml @@ -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"] diff --git a/lib/sparql-smith/Cargo.toml b/lib/sparql-smith/Cargo.toml index 22d361d6..4217afdf 100644 --- a/lib/sparql-smith/Cargo.toml +++ b/lib/sparql-smith/Cargo.toml @@ -20,5 +20,8 @@ limit-offset = ["order"] order = [] sep-0006 = [] +[lints] +workspace = true + [dependencies] arbitrary = { version = "1.3", features = ["derive"] } diff --git a/lib/src/sparql/algebra.rs b/lib/src/sparql/algebra.rs index 17b6cc05..d83241c6 100644 --- a/lib/src/sparql/algebra.rs +++ b/lib/src/sparql/algebra.rs @@ -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 { @@ -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 { @@ -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 { @@ -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 { diff --git a/lib/src/sparql/model.rs b/lib/src/sparql/model.rs index 81712877..326e7603 100644 --- a/lib/src/sparql/model.rs +++ b/lib/src/sparql/model.rs @@ -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>, EvaluationError>> + 'static, diff --git a/lib/src/sparql/service.rs b/lib/src/sparql/service.rs index 2ec0b7a3..4db172e4 100644 --- a/lib/src/sparql/service.rs +++ b/lib/src/sparql/service.rs @@ -49,6 +49,7 @@ use std::time::Duration; /// # Result::<_,Box>::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`]. diff --git a/lib/src/storage/backend/rocksdb.rs b/lib/src/storage/backend/rocksdb.rs index 5e6f4103..ba364cd6 100644 --- a/lib/src/storage/backend/rocksdb.rs +++ b/lib/src/storage/backend/rocksdb.rs @@ -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 { diff --git a/lib/src/storage/error.rs b/lib/src/storage/error.rs index 690b6bfd..8c874d77 100644 --- a/lib/src/storage/error.rs +++ b/lib/src/storage/error.rs @@ -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 { diff --git a/lints/build_clippy_config.py b/lints/build_clippy_config.py new file mode 100644 index 00000000..f56bcb00 --- /dev/null +++ b/lints/build_clippy_config.py @@ -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)) diff --git a/lints/build_config.py b/lints/build_config.py deleted file mode 100644 index 749c0622..00000000 --- a/lints/build_config.py +++ /dev/null @@ -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") diff --git a/python/Cargo.toml b/python/Cargo.toml index 58538d3a..531c01df 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -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 diff --git a/python/src/io.rs b/python/src/io.rs index 86896853..b8c42443 100644 --- a/python/src/io.rs +++ b/python/src/io.rs @@ -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::>() { + if let Ok(triple) = i.extract::>() { writer.write_triple(&*triple) } else { - let quad = i.extract::>()?; + let quad = i.extract::>()?; 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 { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -348,7 +348,7 @@ impl PyRdfFormat { } /// :rtype: RdfFormat - fn __copy__(slf: PyRef<'_, Self>) -> PyRef { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } diff --git a/python/src/model.rs b/python/src/model.rs index db3f0258..cf673d65 100644 --- a/python/src/model.rs +++ b/python/src/model.rs @@ -96,7 +96,7 @@ impl PyNamedNode { } fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult { - if let Ok(other) = other.extract::>() { + if let Ok(other) = other.extract::>() { 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 { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -223,7 +223,7 @@ impl PyBlankNode { } fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult { - if let Ok(other) = other.extract::>() { + if let Ok(other) = other.extract::>() { 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 { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -380,7 +380,7 @@ impl PyLiteral { } fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult { - if let Ok(other) = other.extract::>() { + if let Ok(other) = other.extract::>() { 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 { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -454,7 +454,7 @@ impl PyDefaultGraph { } fn __richcmp__(&self, other: &PyAny, op: CompareOp) -> PyResult { - if let Ok(other) = other.extract::>() { + if let Ok(other) = other.extract::>() { 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 { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -735,7 +735,7 @@ impl PyTriple { } /// :rtype: Triple - fn __copy__(slf: PyRef<'_, Self>) -> PyRef { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -972,7 +972,7 @@ impl PyQuad { } /// :rtype: Quad - fn __copy__(slf: PyRef<'_, Self>) -> PyRef { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -1064,7 +1064,7 @@ impl PyVariable { } /// :rtype: Variable - fn __copy__(slf: PyRef<'_, Self>) -> PyRef { + 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 { - if let Ok(node) = value.extract::>() { + if let Ok(node) = value.extract::>() { 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 { - if let Ok(node) = value.extract::>() { + if let Ok(node) = value.extract::>() { Ok(Self::NamedNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { 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 { - if let Ok(node) = value.extract::>() { + if let Ok(node) = value.extract::>() { Ok(Self::NamedNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { Ok(Self::BlankNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { 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 { - if let Ok(node) = value.extract::>() { + if let Ok(node) = value.extract::>() { Ok(Self::NamedNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { Ok(Self::BlankNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { Ok(Self::Literal(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { 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 { - if let Ok(node) = value.extract::>() { + if let Ok(node) = value.extract::>() { Ok(Self::NamedNode(node)) - } else if let Ok(node) = value.extract::>() { + } else if let Ok(node) = value.extract::>() { Ok(Self::BlankNode(node)) - } else if value.extract::>().is_ok() { + } else if value.extract::>().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 { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -1357,7 +1357,7 @@ pub struct QuadComponentsIter { #[pymethods] impl QuadComponentsIter { - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } diff --git a/python/src/sparql.rs b/python/src/sparql.rs index 8f6c7498..9bce5ab5 100644 --- a/python/src/sparql.rs +++ b/python/src/sparql.rs @@ -164,7 +164,7 @@ pub struct SolutionValueIter { #[pymethods] impl SolutionValueIter { - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -278,7 +278,7 @@ impl PyQuerySolutions { ) } - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -435,7 +435,7 @@ impl PyQueryTriples { ) } - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -637,7 +637,7 @@ impl PyQueryResultsFormat { } /// :rtype: QueryResultsFormat - fn __copy__(slf: PyRef<'_, Self>) -> PyRef { + fn __copy__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } diff --git a/python/src/store.rs b/python/src/store.rs index 81abb840..90b3858c 100644 --- a/python/src/store.rs +++ b/python/src/store.rs @@ -767,7 +767,7 @@ pub struct QuadIter { #[pymethods] impl QuadIter { - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } @@ -786,7 +786,7 @@ pub struct GraphNameIter { #[pymethods] impl GraphNameIter { - fn __iter__(slf: PyRef<'_, Self>) -> PyRef { + fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { slf } diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 59b751c2..6e24e309 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -25,6 +25,9 @@ criterion = "0.5" rio_api = "0.8" rio_turtle = "0.8" +[lints] +workspace = true + [[bench]] name = "parser" harness = false \ No newline at end of file