Skip to content

web search done right

rustup update and fix clippy warnings

Mikkel Denker1d821ef4db56
diff --git a/Cargo.lock b/Cargo.lock
index 89617838..ddd09a55 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "addr2line"
@@ -213,9 +213,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "ascii-canvas"
-version = "3.0.0"
+version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6"
+checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891"
dependencies = [
"term",
]
@@ -494,7 +494,16 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
dependencies = [
- "bit-vec",
+ "bit-vec 0.6.3",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
+dependencies = [
+ "bit-vec 0.8.0",
]
[[package]]
@@ -503,6 +512,12 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
+[[package]]
+name = "bit-vec"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+
[[package]]
name = "bit_field"
version = "0.10.2"
@@ -1427,16 +1442,6 @@ dependencies = [
"dirs-sys 0.4.1",
]
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if",
- "dirs-sys-next",
-]
-
[[package]]
name = "dirs-sys"
version = "0.3.7"
@@ -1460,17 +1465,6 @@ dependencies = [
"windows-sys 0.48.0",
]
-[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users",
- "winapi",
-]
-
[[package]]
name = "displaydoc"
version = "0.2.5"
@@ -2655,6 +2649,15 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "keccak"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
+dependencies = [
+ "cpufeatures",
+]
+
[[package]]
name = "kuchiki"
version = "0.8.1"
@@ -2670,33 +2673,34 @@ dependencies = [
[[package]]
name = "lalrpop"
-version = "0.20.2"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca"
+checksum = "06093b57658c723a21da679530e061a8c25340fa5a6f98e313b542268c7e2a1f"
dependencies = [
"ascii-canvas",
- "bit-set",
+ "bit-set 0.8.0",
"ena",
- "itertools 0.11.0",
+ "itertools 0.13.0",
"lalrpop-util",
"petgraph",
"pico-args",
"regex",
"regex-syntax 0.8.5",
+ "sha3",
"string_cache",
"term",
- "tiny-keccak",
"unicode-xid",
"walkdir",
]
[[package]]
name = "lalrpop-util"
-version = "0.20.2"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553"
+checksum = "feee752d43abd0f4807a921958ab4131f692a44d4d599733d4419c5d586176ce"
dependencies = [
"regex-automata 0.4.8",
+ "rustversion",
]
[[package]]
@@ -3841,8 +3845,8 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d"
dependencies = [
- "bit-set",
- "bit-vec",
+ "bit-set 0.5.3",
+ "bit-vec 0.6.3",
"bitflags 2.6.0",
"lazy_static",
"num-traits",
@@ -4798,6 +4802,16 @@ dependencies = [
"digest",
]
+[[package]]
+name = "sha3"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
+dependencies = [
+ "digest",
+ "keccak",
+]
+
[[package]]
name = "sharded-slab"
version = "0.1.7"
@@ -5370,13 +5384,12 @@ dependencies = [
[[package]]
name = "term"
-version = "0.7.0"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
+checksum = "4df4175de05129f31b80458c6df371a15e7fc3fd367272e6bf938e5c351c7ea0"
dependencies = [
- "dirs-next",
- "rustversion",
- "winapi",
+ "home",
+ "windows-sys 0.52.0",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 469fc0e9..20b20d9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -92,8 +92,8 @@ indicatif = { version = "0.17.7", features = ["rayon"] }
insta = "1.31"
itertools = "0.13.0"
js-sys = "0.3.60"
-lalrpop = { version = "0.20.0", features = ["lexer"] }
-lalrpop-util = { version = "0.20.0", features = ["lexer"] }
+lalrpop = { version = "0.22.0", features = ["lexer"] }
+lalrpop-util = { version = "0.22.0", features = ["lexer"] }
lending-iter = { path = "crates/lending-iter" }
levenshtein_automata = "0.2.1"
libc = "0.2.142"
@@ -181,7 +181,7 @@ url = { version = "2.4.0", features = ["serde"] }
utoipa = { version = "5.2.0", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "8.0.0", features = ["axum"] }
uuid = { version = "1.1.2", features = ["serde", "v4"] }
-wasm-bindgen = "0.2.83"
+wasm-bindgen = "0.2.95"
whatlang = { version = "0.16.0", features = ["serde"] }
xxhash-rust = { version = "0.8.10", features = ["xxh3", "const_xxh3"] }
zipf = "7.0.0"
diff --git a/assets/licenses.html b/assets/licenses.html
index a00a28f6..0c63fdbc 100644
--- a/assets/licenses.html
+++ b/assets/licenses.html
@@ -44,7 +44,7 @@
<h2>Overview of licenses:</h2>
<ul class="licenses-overview">
- <li><a href="#Apache-2.0">Apache License 2.0</a> (409)</li>
+ <li><a href="#Apache-2.0">Apache License 2.0</a> (411)</li>
<li><a href="#MIT">MIT License</a> (190)</li>
<li><a href="#AGPL-3.0">GNU Affero General Public License v3.0</a> (9)</li>
<li><a href="#BSD-3-Clause">BSD 3-Clause &quot;New&quot; or &quot;Revised&quot; License</a> (9)</li>
@@ -4591,8 +4591,6 @@ limitations under the License.
<h3 id="Apache-2.0">Apache License 2.0</h3>
<h4>Used by:</h4>
<ul class="license-used-by">
- <li><a href=" https://github.com/xdg-rs/dirs ">dirs-next 2.0.0</a></li>
- <li><a href=" https://github.com/xdg-rs/dirs/tree/master/dirs-sys ">dirs-sys-next 0.1.2</a></li>
<li><a href=" https://github.com/dirs-dev/dirs-sys-rs ">dirs-sys 0.3.7</a></li>
<li><a href=" https://github.com/dirs-dev/dirs-sys-rs ">dirs-sys 0.4.1</a></li>
<li><a href=" https://github.com/soc/dirs-rs ">dirs 4.0.0</a></li>
@@ -7487,7 +7485,7 @@ limitations under the License.</pre>
<li><a href=" https://github.com/rust-fuzz/arbitrary/ ">arbitrary 1.3.2</a></li>
<li><a href=" https://github.com/vorner/arc-swap ">arc-swap 1.7.1</a></li>
<li><a href=" https://github.com/bluss/arrayvec ">arrayvec 0.7.6</a></li>
- <li><a href=" https://github.com/nikomatsakis/ascii-canvas ">ascii-canvas 3.0.0</a></li>
+ <li><a href=" https://github.com/lalrpop/ascii-canvas ">ascii-canvas 4.0.0</a></li>
<li><a href=" https://github.com/Nullus157/async-compression ">async-compression 0.4.17</a></li>
<li><a href=" https://github.com/embassy-rs/atomic-polyfill ">atomic-polyfill 1.0.3</a></li>
<li><a href=" https://github.com/cuviper/autocfg ">autocfg 1.4.0</a></li>
@@ -7559,8 +7557,8 @@ limitations under the License.</pre>
<li><a href=" https://github.com/rust-lang/jobserver-rs ">jobserver 0.1.32</a></li>
<li><a href=" https://github.com/image-rs/jpeg-decoder ">jpeg-decoder 0.3.1</a></li>
<li><a href=" https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys ">js-sys 0.3.72</a></li>
- <li><a href=" https://github.com/lalrpop/lalrpop ">lalrpop-util 0.20.2</a></li>
- <li><a href=" https://github.com/lalrpop/lalrpop ">lalrpop 0.20.2</a></li>
+ <li><a href=" https://github.com/lalrpop/lalrpop ">lalrpop-util 0.22.0</a></li>
+ <li><a href=" https://github.com/lalrpop/lalrpop ">lalrpop 0.22.0</a></li>
<li><a href=" https://github.com/rust-lang-nursery/lazy-static.rs ">lazy_static 1.5.0</a></li>
<li><a href=" https://github.com/rust-fuzz/libfuzzer ">libfuzzer-sys 0.4.7</a></li>
<li><a href=" https://github.com/sunfishcode/linux-raw-sys ">linux-raw-sys 0.4.14</a></li>
@@ -7621,7 +7619,7 @@ limitations under the License.</pre>
<li><a href=" https://github.com/alexcrichton/tar-rs ">tar 0.4.42</a></li>
<li><a href=" https://github.com/Stebalien/tempfile ">tempfile 3.13.0</a></li>
<li><a href=" https://github.com/servo/tendril ">tendril 0.4.3</a></li>
- <li><a href=" https://github.com/Stebalien/term ">term 0.7.0</a></li>
+ <li><a href=" https://github.com/Stebalien/term ">term 1.0.0</a></li>
<li><a href=" https://github.com/Amanieu/thread_local-rs ">thread_local 1.1.8</a></li>
<li><a href=" https://github.com/tikv/jemallocator ">tikv-jemalloc-sys 0.5.4+5.3.0-patched</a></li>
<li><a href=" https://github.com/tikv/jemallocator ">tikv-jemallocator 0.5.4</a></li>
@@ -7856,7 +7854,9 @@ limitations under the License.
<h4>Used by:</h4>
<ul class="license-used-by">
<li><a href=" https://github.com/contain-rs/bit-set ">bit-set 0.5.3</a></li>
+ <li><a href=" https://github.com/contain-rs/bit-set ">bit-set 0.8.0</a></li>
<li><a href=" https://github.com/contain-rs/bit-vec ">bit-vec 0.6.3</a></li>
+ <li><a href=" https://github.com/contain-rs/bit-vec ">bit-vec 0.8.0</a></li>
<li><a href=" https://github.com/EmbarkStudios/cfg-expr ">cfg-expr 0.15.8</a></li>
<li><a href=" https://github.com/marcianx/downcast-rs ">downcast-rs 1.2.1</a></li>
<li><a href=" https://github.com/contain-rs/linked-hash-map ">linked-hash-map 0.5.6</a></li>
@@ -8079,10 +8079,12 @@ limitations under the License.
<li><a href=" https://github.com/RustCrypto/traits ">digest 0.10.7</a></li>
<li><a href=" https://github.com/RustCrypto/MACs ">hmac 0.12.1</a></li>
<li><a href=" https://github.com/RustCrypto/utils ">inout 0.1.3</a></li>
+ <li><a href=" https://github.com/RustCrypto/sponges/tree/master/keccak ">keccak 0.1.5</a></li>
<li><a href=" https://github.com/RustCrypto/traits/tree/master/password-hash ">password-hash 0.4.2</a></li>
<li><a href=" https://github.com/RustCrypto/password-hashes/tree/master/pbkdf2 ">pbkdf2 0.11.0</a></li>
<li><a href=" https://github.com/RustCrypto/hashes ">sha1 0.10.6</a></li>
<li><a href=" https://github.com/RustCrypto/hashes ">sha2 0.10.8</a></li>
+ <li><a href=" https://github.com/RustCrypto/hashes ">sha3 0.10.8</a></li>
</ul>
<pre class="license-text"> Apache License
Version 2.0, January 2004
diff --git a/crates/client-wasm/Cargo.toml b/crates/client-wasm/Cargo.toml
index 2b290661..b1ebb792 100644
--- a/crates/client-wasm/Cargo.toml
+++ b/crates/client-wasm/Cargo.toml
@@ -21,9 +21,16 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
bincode.workspace = true
js-sys.workspace = true
-optics = {path = "../optics"}
+optics = { path = "../optics" }
serde-wasm-bindgen.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
wasm-bindgen.workspace = true
+
+
+# https://github.com/rustwasm/wasm-bindgen/issues/4283
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = [
+ 'cfg(wasm_bindgen_unstable_test_coverage)',
+] }
diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml
index e1791bae..f2dda5fb 100644
--- a/crates/core/Cargo.toml
+++ b/crates/core/Cargo.toml
@@ -11,10 +11,13 @@ version = "0.1.0"
[features]
cors = []
-default = ["cors", "dev"]
-dev = ["cors"]
+default = ["cors", "dev", "serde"]
+dev = ["cors", "serde"]
return_body = []
+# DOESN'T DO ANYTHING. This is only used to silence a warning from openraft.
+serde = []
+
[[bin]]
name = "stract"
path = "src/main.rs"
diff --git a/crates/core/src/ampc/dht_conn.rs b/crates/core/src/ampc/dht_conn.rs
index 42e76ab7..6336ec82 100644
--- a/crates/core/src/ampc/dht_conn.rs
+++ b/crates/core/src/ampc/dht_conn.rs
@@ -314,9 +314,9 @@ impl<S> DhtTableIterator<S> {
}
}
-impl<'a, S> Iterator for DhtTableIterator<S>
+impl<S> Iterator for DhtTableIterator<S>
where
- S: Stream<Item = Result<(dht::Key, dht::Value)>> + 'a,
+ S: Stream<Item = Result<(dht::Key, dht::Value)>>,
{
type Item = (dht::Key, dht::Value);
diff --git a/crates/core/src/bincode_utils.rs b/crates/core/src/bincode_utils.rs
index deded33b..d631137f 100644
--- a/crates/core/src/bincode_utils.rs
+++ b/crates/core/src/bincode_utils.rs
@@ -102,7 +102,7 @@ mod de_owned {
pub(crate) de: &'a mut DE,
}
- impl<'a, 'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'a, DE> {
+ impl<'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;
fn deserialize_any<V>(self, _: V) -> Result<V::Value, Self::Error>
@@ -443,7 +443,7 @@ mod de_owned {
}
}
- impl<'de, 'a, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'a, DE> {
+ impl<'de, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;
type Variant = Self;
@@ -457,7 +457,7 @@ mod de_owned {
}
}
- impl<'de, 'a, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'a, DE> {
+ impl<'de, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;
fn unit_variant(self) -> Result<(), Self::Error> {
@@ -570,7 +570,7 @@ mod ser {
pub(super) enc: &'a mut ENC,
}
- impl<'a, ENC> Serializer for SerdeEncoder<'a, ENC>
+ impl<ENC> Serializer for SerdeEncoder<'_, ENC>
where
ENC: Encoder,
{
@@ -769,7 +769,7 @@ mod ser {
type Compound<'a, ENC> = SerdeEncoder<'a, ENC>;
- impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeSeq for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -785,7 +785,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeTuple for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -801,7 +801,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeTupleStruct for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -817,7 +817,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeTupleVariant for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -833,7 +833,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeMap for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -856,7 +856,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeStruct for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
@@ -872,7 +872,7 @@ mod ser {
}
}
- impl<'a, ENC: Encoder> SerializeStructVariant for Compound<'a, ENC> {
+ impl<ENC: Encoder> SerializeStructVariant for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;
diff --git a/crates/core/src/distributed/sonic/mod.rs b/crates/core/src/distributed/sonic/mod.rs
index 713483c3..a514cac8 100644
--- a/crates/core/src/distributed/sonic/mod.rs
+++ b/crates/core/src/distributed/sonic/mod.rs
@@ -263,7 +263,7 @@ pub struct Request<'a, Req, Res> {
body: Option<Req>,
}
-impl<'a, Req, Res> Request<'a, Req, Res>
+impl<Req, Res> Request<'_, Req, Res>
where
Res: bincode::Encode,
{
diff --git a/crates/core/src/entrypoint/entity.rs b/crates/core/src/entrypoint/entity.rs
index 05b7f454..365993ad 100644
--- a/crates/core/src/entrypoint/entity.rs
+++ b/crates/core/src/entrypoint/entity.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -128,7 +128,7 @@ fn article_to_entity(article: Article) -> Entity {
}
}
-impl<'a> Iterator for EntityIterator<'a> {
+impl Iterator for EntityIterator<'_> {
type Item = Entity;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/crates/core/src/generic_query/collector/mod.rs b/crates/core/src/generic_query/collector/mod.rs
index 230339c5..97151eaa 100644
--- a/crates/core/src/generic_query/collector/mod.rs
+++ b/crates/core/src/generic_query/collector/mod.rs
@@ -106,7 +106,7 @@ where
}
}
-impl<'a, T> tantivy::collector::Collector for TantivyCollector<'a, T>
+impl<T> tantivy::collector::Collector for TantivyCollector<'_, T>
where
T: Collector,
{
diff --git a/crates/core/src/numericalfield_reader.rs b/crates/core/src/numericalfield_reader.rs
index 072b9959..a32e04bb 100644
--- a/crates/core/src/numericalfield_reader.rs
+++ b/crates/core/src/numericalfield_reader.rs
@@ -232,7 +232,7 @@ pub struct FieldReader<'a> {
doc: DocId,
}
-impl<'a> FieldReader<'a> {
+impl FieldReader<'_> {
pub fn get(&self, field: NumericalFieldEnum) -> Option<Value> {
if field.orientation().contains(Orientation::ROW) {
let field_id = self.field_ids.get(field)?;
diff --git a/crates/core/src/query/pattern_query/mod.rs b/crates/core/src/query/pattern_query/mod.rs
index 75f76659..99febf82 100644
--- a/crates/core/src/query/pattern_query/mod.rs
+++ b/crates/core/src/query/pattern_query/mod.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
diff --git a/crates/core/src/query/pattern_query/scorer.rs b/crates/core/src/query/pattern_query/scorer.rs
index 4818ff4d..abb8d0a2 100644
--- a/crates/core/src/query/pattern_query/scorer.rs
+++ b/crates/core/src/query/pattern_query/scorer.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -382,11 +382,7 @@ fn intersection_with_slop(left: &[u32], right: &[u32], out: &mut [u32], slop: u3
// left_val < right_slop -> left index increment.
// right_slop <= left_val <= right -> find the best match.
// left_val > right -> right index increment.
- let right_slop = if right_val >= slop {
- right_val - slop
- } else {
- 0
- };
+ let right_slop = right_val.saturating_sub(slop);
if left_val < right_slop {
left_index += 1;
diff --git a/crates/core/src/query/pattern_query/weight.rs b/crates/core/src/query/pattern_query/weight.rs
index 65824943..b907c713 100644
--- a/crates/core/src/query/pattern_query/weight.rs
+++ b/crates/core/src/query/pattern_query/weight.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
diff --git a/crates/core/src/snippet.rs b/crates/core/src/snippet.rs
index 9edf5cb2..99af9c15 100644
--- a/crates/core/src/snippet.rs
+++ b/crates/core/src/snippet.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -31,14 +31,14 @@ use utoipa::ToSchema;
use itertools::Itertools;
use whatlang::Lang;
-/// For now we use an algorithm similar to the `UnifiedHighlighter` in lucene <https://lucene.apache.org/core/7_3_1/highlighter/org/apache/lucene/search/uhighlight/UnifiedHighlighter.html>.
-/// The document text is treated as the entire corpus, and each passage is scored as a document in this corpus using BM25.
-/// The top scoring passage is used as the start of a snippet, maybe combined with the subsequent passage(s) in order to
-/// reach the desired snippet length.
-///
-/// In the future we want to implement something closer to the method described in <https://cs.pomona.edu/~dkauchak/ir_project/whitepapers/Snippet-IL.pdf>.
-/// This might require us to store each paragraph of the webpage separately to get adequate performance (maybe we can split passages online with adequate performance
-/// but we need to test this).
+// For now we use an algorithm similar to the `UnifiedHighlighter` in lucene <https://lucene.apache.org/core/7_3_1/highlighter/org/apache/lucene/search/uhighlight/UnifiedHighlighter.html>.
+// The document text is treated as the entire corpus, and each passage is scored as a document in this corpus using BM25.
+// The top scoring passage is used as the start of a snippet, maybe combined with the subsequent passage(s) in order to
+// reach the desired snippet length.
+//
+// In the future we want to implement something closer to the method described in <https://cs.pomona.edu/~dkauchak/ir_project/whitepapers/Snippet-IL.pdf>.
+// This might require us to store each paragraph of the webpage separately to get adequate performance (maybe we can split passages online with adequate performance
+// but we need to test this).
const K1: f64 = 1.2;
const B: f64 = 0.75;
diff --git a/crates/core/src/summarizer.rs b/crates/core/src/summarizer.rs
index 2e847da6..11599222 100644
--- a/crates/core/src/summarizer.rs
+++ b/crates/core/src/summarizer.rs
@@ -35,25 +35,25 @@ struct CandidatePassage<'a> {
score: f32,
}
-impl<'a> PartialOrd for CandidatePassage<'a> {
+impl PartialOrd for CandidatePassage<'_> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
-impl<'a> Ord for CandidatePassage<'a> {
+impl Ord for CandidatePassage<'_> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.score.total_cmp(&other.score)
}
}
-impl<'a> PartialEq for CandidatePassage<'a> {
+impl PartialEq for CandidatePassage<'_> {
fn eq(&self, other: &Self) -> bool {
self.score == other.score
}
}
-impl<'a> Eq for CandidatePassage<'a> {}
+impl Eq for CandidatePassage<'_> {}
struct OverlappingSents<'a> {
text: &'a str,
diff --git a/crates/core/src/tokenizer/fields/default.rs b/crates/core/src/tokenizer/fields/default.rs
index 50328620..6de5b529 100644
--- a/crates/core/src/tokenizer/fields/default.rs
+++ b/crates/core/src/tokenizer/fields/default.rs
@@ -80,7 +80,7 @@ impl tantivy::tokenizer::Tokenizer for Normal {
}
}
-impl<'a> tantivy::tokenizer::TokenStream for NormalTokenStream<'a> {
+impl tantivy::tokenizer::TokenStream for NormalTokenStream<'_> {
fn advance(&mut self) -> bool {
self.token = self.stream.next().map(|token| {
let span = token.span();
diff --git a/crates/core/src/tokenizer/fields/json.rs b/crates/core/src/tokenizer/fields/json.rs
index 86c612b8..e142f20a 100644
--- a/crates/core/src/tokenizer/fields/json.rs
+++ b/crates/core/src/tokenizer/fields/json.rs
@@ -135,7 +135,7 @@ pub struct JsonFieldTokenStream<'a> {
token: tantivy::tokenizer::Token,
}
-impl<'a> JsonFieldTokenStream<'a> {
+impl JsonFieldTokenStream<'_> {
// search for the end of the current token.
fn search_token_end(&mut self, is_quote: bool) -> usize {
let mut escaped = false;
@@ -159,7 +159,7 @@ impl<'a> JsonFieldTokenStream<'a> {
}
}
-impl<'a> tantivy::tokenizer::TokenStream for JsonFieldTokenStream<'a> {
+impl tantivy::tokenizer::TokenStream for JsonFieldTokenStream<'_> {
fn advance(&mut self) -> bool {
self.token.text.clear();
self.token.position = self.token.position.wrapping_add(1);
diff --git a/crates/core/src/tokenizer/fields/ngram.rs b/crates/core/src/tokenizer/fields/ngram.rs
index 01b4e7e0..53d7f4f3 100644
--- a/crates/core/src/tokenizer/fields/ngram.rs
+++ b/crates/core/src/tokenizer/fields/ngram.rs
@@ -43,7 +43,7 @@ fn reuse_token_alloc(token: &mut tantivy::tokenizer::Token, new_token: &tantivy:
token.position_length = new_token.position_length;
}
-impl<'a, const N: usize> tantivy::tokenizer::TokenStream for NGramTokenStream<'a, N> {
+impl<const N: usize> tantivy::tokenizer::TokenStream for NGramTokenStream<'_, N> {
fn advance(&mut self) -> bool {
if !self.inner.advance() {
return false;
diff --git a/crates/core/src/tokenizer/fields/pred.rs b/crates/core/src/tokenizer/fields/pred.rs
index bfc776a8..66b71a84 100644
--- a/crates/core/src/tokenizer/fields/pred.rs
+++ b/crates/core/src/tokenizer/fields/pred.rs
@@ -48,7 +48,7 @@ pub struct PredTokenStream<'a> {
next_position: usize,
}
-impl<'a> tantivy::tokenizer::TokenStream for PredTokenStream<'a> {
+impl tantivy::tokenizer::TokenStream for PredTokenStream<'_> {
fn advance(&mut self) -> bool {
self.token = self.stream.next().map(|token| {
let span = token.span();
diff --git a/crates/core/src/web_spell/mod.rs b/crates/core/src/web_spell/mod.rs
index fdcdba51..36384306 100644
--- a/crates/core/src/web_spell/mod.rs
+++ b/crates/core/src/web_spell/mod.rs
@@ -194,7 +194,7 @@ pub struct MergePointer<'a> {
pub is_finished: bool,
}
-impl<'a> MergePointer<'a> {
+impl MergePointer<'_> {
pub fn advance(&mut self) -> bool {
self.is_finished = self
.stream
@@ -209,13 +209,13 @@ impl<'a> MergePointer<'a> {
}
}
-impl<'a> PartialOrd for MergePointer<'a> {
+impl PartialOrd for MergePointer<'_> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
-impl<'a> Ord for MergePointer<'a> {
+impl Ord for MergePointer<'_> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match (self.is_finished, other.is_finished) {
(true, true) | (false, false) => self.term.cmp(&other.term),
@@ -225,13 +225,13 @@ impl<'a> Ord for MergePointer<'a> {
}
}
-impl<'a> PartialEq for MergePointer<'a> {
+impl PartialEq for MergePointer<'_> {
fn eq(&self, other: &Self) -> bool {
self.term == other.term && self.is_finished == other.is_finished
}
}
-impl<'a> Eq for MergePointer<'a> {}
+impl Eq for MergePointer<'_> {}
#[cfg(test)]
mod tests {
diff --git a/crates/core/src/webgraph/query/collector/mod.rs b/crates/core/src/webgraph/query/collector/mod.rs
index bb50daa8..23994441 100644
--- a/crates/core/src/webgraph/query/collector/mod.rs
+++ b/crates/core/src/webgraph/query/collector/mod.rs
@@ -74,7 +74,7 @@ where
}
}
-impl<'a, T> tantivy::collector::Collector for TantivyCollector<'a, T>
+impl<T> tantivy::collector::Collector for TantivyCollector<'_, T>
where
T: Collector,
{
diff --git a/crates/core/src/webpage/html/fn_cache.rs b/crates/core/src/webpage/html/fn_cache.rs
index 3bb35abd..68a67164 100644
--- a/crates/core/src/webpage/html/fn_cache.rs
+++ b/crates/core/src/webpage/html/fn_cache.rs
@@ -84,7 +84,7 @@ cache! {
/// Some manual implementations so we can use previously cached data
/// to compute the next field.
-impl<'a> FnCache<'a> {
+impl FnCache<'_> {
pub fn first_ingredient_tag_id(&mut self) -> Option<&String> {
if self.first_ingredient_tag_id.is_none() {
let root = self.html.root.clone(); // Node is just a NodeRef, so it's cheap to clone
diff --git a/crates/core/src/widgets/thesaurus.rs b/crates/core/src/widgets/thesaurus.rs
index 241d8fe9..b5805b69 100644
--- a/crates/core/src/widgets/thesaurus.rs
+++ b/crates/core/src/widgets/thesaurus.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -312,7 +312,7 @@ impl<'a> NodeQuery<'a> {
}
}
-impl<'a> Clone for NodeQuery<'a> {
+impl Clone for NodeQuery<'_> {
fn clone(&self) -> Self {
Self {
node: self.node,
diff --git a/crates/file-store/src/random_lookup.rs b/crates/file-store/src/random_lookup.rs
index b3011f6a..09b7fc40 100644
--- a/crates/file-store/src/random_lookup.rs
+++ b/crates/file-store/src/random_lookup.rs
@@ -136,7 +136,7 @@ pub struct RandomLookupIter<'a, V> {
_phantom: std::marker::PhantomData<V>,
}
-impl<'a, V> Iterator for RandomLookupIter<'a, V>
+impl<V> Iterator for RandomLookupIter<'_, V>
where
V: ConstSerializable,
{
diff --git a/crates/kuchiki/src/select.rs b/crates/kuchiki/src/select.rs
index acf28331..28f73d6e 100644
--- a/crates/kuchiki/src/select.rs
+++ b/crates/kuchiki/src/select.rs
@@ -290,9 +290,7 @@ impl selectors::Element for NodeDataRef<ElementData> {
self.attributes
.borrow()
.get(local_name!("id"))
- .map_or(false, |id_attr| {
- case_sensitivity.eq(id.0.as_bytes(), id_attr.as_bytes())
- })
+ .is_some_and(|id_attr| case_sensitivity.eq(id.0.as_bytes(), id_attr.as_bytes()))
}
#[inline]
@@ -324,7 +322,7 @@ impl selectors::Element for NodeDataRef<ElementData> {
NamespaceConstraint::Specific(ns_url) => attrs
.map
.get(&ExpandedName::new(ns_url, local_name.0.clone()))
- .map_or(false, |attr| operation.eval_str(&attr.value)),
+ .is_some_and(|attr| operation.eval_str(&attr.value)),
}
}
diff --git a/crates/kuchiki/src/xpath.rs b/crates/kuchiki/src/xpath.rs
index 227ba3c5..a60e7e14 100644
--- a/crates/kuchiki/src/xpath.rs
+++ b/crates/kuchiki/src/xpath.rs
@@ -87,7 +87,7 @@ impl Predicate {
.attributes
.borrow()
.get(attr.as_str())
- .map_or(false, |v| v.split_ascii_whitespace().any(|v| v == value)),
+ .is_some_and(|v| v.split_ascii_whitespace().any(|v| v == value)),
},
}
}
diff --git a/crates/optics-lsp/Cargo.lock b/crates/optics-lsp/Cargo.lock
index d693f5d7..a27a6e04 100644
--- a/crates/optics-lsp/Cargo.lock
+++ b/crates/optics-lsp/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "aho-corasick"
@@ -11,11 +11,20 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "ascii-canvas"
-version = "3.0.0"
+version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6"
+checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891"
dependencies = [
"term",
]
@@ -56,7 +65,16 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
dependencies = [
- "bit-vec",
+ "bit-vec 0.6.3",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
+dependencies = [
+ "bit-vec 0.8.0",
]
[[package]]
@@ -65,6 +83,12 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
+[[package]]
+name = "bit-vec"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -77,6 +101,15 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
[[package]]
name = "bumpalo"
version = "3.12.0"
@@ -100,36 +133,32 @@ dependencies = [
]
[[package]]
-name = "crunchy"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
-
-[[package]]
-name = "diff"
-version = "0.1.13"
+name = "cpufeatures"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
+checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3"
+dependencies = [
+ "libc",
+]
[[package]]
-name = "dirs-next"
-version = "2.0.0"
+name = "crypto-common"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "cfg-if",
- "dirs-sys-next",
+ "generic-array",
+ "typenum",
]
[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
+name = "digest"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
- "libc",
- "redox_users",
- "winapi",
+ "block-buffer",
+ "crypto-common",
]
[[package]]
@@ -153,16 +182,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
-[[package]]
-name = "errno"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
-dependencies = [
- "libc",
- "windows-sys 0.52.0",
-]
-
[[package]]
name = "fixedbitset"
version = "0.4.2"
@@ -184,6 +203,16 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
[[package]]
name = "getrandom"
version = "0.2.8"
@@ -210,10 +239,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
-name = "hermit-abi"
-version = "0.3.3"
+name = "home"
+version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
+checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
+dependencies = [
+ "windows-sys 0.52.0",
+]
[[package]]
name = "idna"
@@ -246,26 +278,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "is-terminal"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
-dependencies = [
- "hermit-abi",
- "rustix",
- "windows-sys 0.48.0",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
-dependencies = [
- "either",
-]
-
[[package]]
name = "itertools"
version = "0.12.1"
@@ -299,36 +311,45 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "keccak"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
+dependencies = [
+ "cpufeatures",
+]
+
[[package]]
name = "lalrpop"
-version = "0.20.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8"
+checksum = "06093b57658c723a21da679530e061a8c25340fa5a6f98e313b542268c7e2a1f"
dependencies = [
"ascii-canvas",
- "bit-set",
- "diff",
+ "bit-set 0.8.0",
"ena",
- "is-terminal",
- "itertools 0.10.5",
+ "itertools 0.13.0",
"lalrpop-util",
"petgraph",
"pico-args",
"regex",
- "regex-syntax 0.7.5",
+ "regex-syntax 0.8.4",
+ "sha3",
"string_cache",
"term",
- "tiny-keccak",
"unicode-xid",
+ "walkdir",
]
[[package]]
name = "lalrpop-util"
-version = "0.20.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d"
+checksum = "feee752d43abd0f4807a921958ab4131f692a44d4d599733d4419c5d586176ce"
dependencies = [
- "regex",
+ "regex-automata",
+ "rustversion",
]
[[package]]
@@ -349,12 +370,6 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
-[[package]]
-name = "linux-raw-sys"
-version = "0.4.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
-
[[package]]
name = "lock_api"
version = "0.4.9"
@@ -421,9 +436,9 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.5.0"
+version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "new_debug_unreachable"
@@ -560,8 +575,8 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d"
dependencies = [
- "bit-set",
- "bit-vec",
+ "bit-set 0.5.3",
+ "bit-vec 0.6.3",
"bitflags 2.4.1",
"lazy_static",
"num-traits",
@@ -640,39 +655,33 @@ dependencies = [
"bitflags 1.3.2",
]
-[[package]]
-name = "redox_users"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
-dependencies = [
- "getrandom",
- "redox_syscall",
- "thiserror",
-]
-
[[package]]
name = "regex"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
- "aho-corasick",
+ "aho-corasick 0.7.20",
"memchr",
"regex-syntax 0.6.28",
]
[[package]]
-name = "regex-syntax"
-version = "0.6.28"
+name = "regex-automata"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
+checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
+dependencies = [
+ "aho-corasick 1.1.3",
+ "memchr",
+ "regex-syntax 0.8.4",
+]
[[package]]
name = "regex-syntax"
-version = "0.7.5"
+version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
+checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "regex-syntax"
@@ -680,19 +689,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
-[[package]]
-name = "rustix"
-version = "0.38.34"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
-dependencies = [
- "bitflags 2.4.1",
- "errno",
- "libc",
- "linux-raw-sys",
- "windows-sys 0.52.0",
-]
-
[[package]]
name = "rustversion"
version = "1.0.12"
@@ -705,6 +701,15 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
[[package]]
name = "scopeguard"
version = "1.1.0"
@@ -764,6 +769,16 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "sha3"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
+dependencies = [
+ "digest",
+ "keccak",
+]
+
[[package]]
name = "siphasher"
version = "0.3.10"
@@ -813,13 +828,12 @@ dependencies = [
[[package]]
name = "term"
-version = "0.7.0"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
+checksum = "4df4175de05129f31b80458c6df371a15e7fc3fd367272e6bf938e5c351c7ea0"
dependencies = [
- "dirs-next",
- "rustversion",
- "winapi",
+ "home",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -842,15 +856,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "tiny-keccak"
-version = "2.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
-dependencies = [
- "crunchy",
-]
-
[[package]]
name = "tinyvec"
version = "1.6.0"
@@ -866,6 +871,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+[[package]]
+name = "typenum"
+version = "1.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
+
[[package]]
name = "unarray"
version = "0.1.4"
@@ -941,12 +952,28 @@ dependencies = [
"syn 2.0.48",
]
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
[[package]]
name = "virtue"
version = "0.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b6826a786a78cf1bb0937507b5551fb6f827d66269a24b00af0de247b19bbc7"
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -1008,27 +1035,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
[[package]]
-name = "winapi"
-version = "0.3.9"
+name = "winapi-util"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
+ "windows-sys 0.52.0",
]
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
[[package]]
name = "windows-sys"
version = "0.45.0"
@@ -1038,15 +1052,6 @@ dependencies = [
"windows-targets 0.42.1",
]
-[[package]]
-name = "windows-sys"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
-dependencies = [
- "windows-targets 0.48.5",
-]
-
[[package]]
name = "windows-sys"
version = "0.52.0"
@@ -1071,21 +1076,6 @@ dependencies = [
"windows_x86_64_msvc 0.42.1",
]
-[[package]]
-name = "windows-targets"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
-dependencies = [
- "windows_aarch64_gnullvm 0.48.5",
- "windows_aarch64_msvc 0.48.5",
- "windows_i686_gnu 0.48.5",
- "windows_i686_msvc 0.48.5",
- "windows_x86_64_gnu 0.48.5",
- "windows_x86_64_gnullvm 0.48.5",
- "windows_x86_64_msvc 0.48.5",
-]
-
[[package]]
name = "windows-targets"
version = "0.52.6"
@@ -1108,12 +1098,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
-
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
@@ -1126,12 +1110,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
-
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
@@ -1144,12 +1122,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
-[[package]]
-name = "windows_i686_gnu"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
-
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
@@ -1168,12 +1140,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
-[[package]]
-name = "windows_i686_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
-
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
@@ -1186,12 +1152,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
-
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
@@ -1204,12 +1164,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
-
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
@@ -1222,12 +1176,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
-
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
diff --git a/crates/optics/src/lexer.rs b/crates/optics/src/lexer.rs
index 084d5ddf..55647fdb 100644
--- a/crates/optics/src/lexer.rs
+++ b/crates/optics/src/lexer.rs
@@ -56,7 +56,7 @@ pub enum Token<'a> {
Number(&'a str),
}
-impl<'a> Display for Token<'a> {
+impl Display for Token<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Token::SemiColon => f.write_str(";"),
diff --git a/crates/speedy-kv/src/automaton.rs b/crates/speedy-kv/src/automaton.rs
index 45ffaf80..4a66487f 100644
--- a/crates/speedy-kv/src/automaton.rs
+++ b/crates/speedy-kv/src/automaton.rs
@@ -1,5 +1,5 @@
// Stract is an open source web search engine.
-// Copyright (C) 2023 Stract ApS
+// Copyright (C) 2024 Stract ApS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -17,7 +17,7 @@
#[derive(Clone)]
pub struct ExactMatch<'a>(pub &'a [u8]);
-impl<'a> fst::Automaton for ExactMatch<'a> {
+impl fst::Automaton for ExactMatch<'_> {
type State = Option<usize>;
fn start(&self) -> Self::State {
diff --git a/crates/speedy-kv/src/blob_id_index.rs b/crates/speedy-kv/src/blob_id_index.rs
index 480060b5..622ec4e3 100644
--- a/crates/speedy-kv/src/blob_id_index.rs
+++ b/crates/speedy-kv/src/blob_id_index.rs
@@ -124,7 +124,7 @@ where
}
}
-impl<'a, K, A> Iterator for BlobIdIndexIter<'a, K, A>
+impl<K, A> Iterator for BlobIdIndexIter<'_, K, A>
where
A: fst::Automaton,
{
diff --git a/crates/speedy-kv/src/serialized.rs b/crates/speedy-kv/src/serialized.rs
index 38491db4..f75bd0fb 100644
--- a/crates/speedy-kv/src/serialized.rs
+++ b/crates/speedy-kv/src/serialized.rs
@@ -103,7 +103,7 @@ pub struct SerializedRef<'a, T> {
_marker: std::marker::PhantomData<T>,
}
-impl<'a, T> std::fmt::Debug for SerializedRef<'a, T> {
+impl<T> std::fmt::Debug for SerializedRef<'_, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let truncated = self.bytes.len() > 16;
@@ -125,21 +125,21 @@ impl<'a, T> std::fmt::Debug for SerializedRef<'a, T> {
}
}
-impl<'a, T> Clone for SerializedRef<'a, T> {
+impl<T> Clone for SerializedRef<'_, T> {
fn clone(&self) -> Self {
*self
}
}
-impl<'a, T> Copy for SerializedRef<'a, T> {}
+impl<T> Copy for SerializedRef<'_, T> {}
-impl<'a, T> AsRef<[u8]> for SerializedRef<'a, T> {
+impl<T> AsRef<[u8]> for SerializedRef<'_, T> {
fn as_ref(&self) -> &[u8] {
self.as_bytes()
}
}
-impl<'a, T> SerializedRef<'a, T> {
+impl<T> SerializedRef<'_, T> {
pub fn as_bytes(&self) -> &[u8] {
self.bytes
}
@@ -163,21 +163,21 @@ impl<'a, T, const N: usize> From<&'a [u8; N]> for SerializedRef<'a, T> {
}
}
-impl<'a, T> PartialOrd for SerializedRef<'a, T> {
+impl<T> PartialOrd for SerializedRef<'_, T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
-impl<'a, T> PartialEq for SerializedRef<'a, T> {
+impl<T> PartialEq for SerializedRef<'_, T> {
fn eq(&self, other: &Self) -> bool {
self.bytes == other.bytes
}
}
-impl<'a, T> Eq for SerializedRef<'a, T> {}
+impl<T> Eq for SerializedRef<'_, T> {}
-impl<'a, T> Ord for SerializedRef<'a, T> {
+impl<T> Ord for SerializedRef<'_, T> {
fn cmp(&self, other: &Self) -> Ordering {
self.bytes.cmp(other.bytes)
}
diff --git a/crates/tantivy/src/collector/multi_collector.rs b/crates/tantivy/src/collector/multi_collector.rs
index 7acf745d..ef0e71c5 100644
--- a/crates/tantivy/src/collector/multi_collector.rs
+++ b/crates/tantivy/src/collector/multi_collector.rs
@@ -153,7 +153,7 @@ impl<'a> MultiCollector<'a> {
}
}
-impl<'a> Collector for MultiCollector<'a> {
+impl Collector for MultiCollector<'_> {
type Fruit = MultiFruit;
type Child = MultiCollectorChild;
diff --git a/crates/tantivy/src/columnar/block_accessor.rs b/crates/tantivy/src/columnar/block_accessor.rs
index 0807b2df..8eef1187 100644
--- a/crates/tantivy/src/columnar/block_accessor.rs
+++ b/crates/tantivy/src/columnar/block_accessor.rs
@@ -30,7 +30,7 @@ impl<T: PartialOrd + Copy + std::fmt::Debug + Send + Sync + 'static + Default>
///
/// The docs is used if the column is full (each docs has exactly one value), otherwise the
/// internal docid vec is used for the iterator, which e.g. may contain duplicate docs.
- pub fn iter_docid_vals<'a>(&'a self, docs: &'a [u32]) -> impl Iterator<Item = (DocId, T)> + '_ {
+ pub fn iter_docid_vals<'a>(&'a self, docs: &'a [u32]) -> impl Iterator<Item = (DocId, T)> + 'a {
docs.iter().cloned().zip(self.val_cache.iter().cloned())
}
}
diff --git a/crates/tantivy/src/columnar/column_values/merge.rs b/crates/tantivy/src/columnar/column_values/merge.rs
index 04f458b4..a2834abf 100644
--- a/crates/tantivy/src/columnar/column_values/merge.rs
+++ b/crates/tantivy/src/columnar/column_values/merge.rs
@@ -10,7 +10,7 @@ pub(crate) struct MergedColumnValues<'a, T> {
pub(crate) merge_row_order: &'a MergeRowOrder,
}
-impl<'a, T: Copy + PartialOrd + Debug + 'static> Iterable<T> for MergedColumnValues<'a, T> {
+impl<T: Copy + PartialOrd + Debug + 'static> Iterable<T> for MergedColumnValues<'_, T> {
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_> {
match self.merge_row_order {
MergeRowOrder::Stack(_) => Box::new(
diff --git a/crates/tantivy/src/columnar/column_values/u64_based/blockwise_linear.rs b/crates/tantivy/src/columnar/column_values/u64_based/blockwise_linear.rs
index c86986ed..805b1977 100644
--- a/crates/tantivy/src/columnar/column_values/u64_based/blockwise_linear.rs
+++ b/crates/tantivy/src/columnar/column_values/u64_based/blockwise_linear.rs
@@ -44,7 +44,7 @@ impl BinarySerializable for Block {
}
fn compute_num_blocks(num_vals: u32) -> u32 {
- (num_vals + BLOCK_SIZE - 1) / BLOCK_SIZE
+ num_vals.div_ceil(BLOCK_SIZE)
}
pub struct BlockwiseLinearEstimator {
diff --git a/crates/tantivy/src/columnar/columnar/merge/merge_dict_column.rs b/crates/tantivy/src/columnar/columnar/merge/merge_dict_column.rs
index 5d497a4e..d0e944d7 100644
--- a/crates/tantivy/src/columnar/columnar/merge/merge_dict_column.rs
+++ b/crates/tantivy/src/columnar/columnar/merge/merge_dict_column.rs
@@ -39,7 +39,7 @@ struct RemappedTermOrdinalsValues<'a> {
merge_row_order: &'a MergeRowOrder,
}
-impl<'a> Iterable for RemappedTermOrdinalsValues<'a> {
+impl Iterable for RemappedTermOrdinalsValues<'_> {
fn boxed_iter(&self) -> Box<dyn Iterator<Item = u64> + '_> {
match self.merge_row_order {
MergeRowOrder::Stack(_) => self.boxed_iter_stacked(),
@@ -50,7 +50,7 @@ impl<'a> Iterable for RemappedTermOrdinalsValues<'a> {
}
}
-impl<'a> RemappedTermOrdinalsValues<'a> {
+impl RemappedTermOrdinalsValues<'_> {
fn boxed_iter_stacked(&self) -> Box<dyn Iterator<Item = u64> + '_> {
let iter = self
.bytes_columns
diff --git a/crates/tantivy/src/columnar/columnar/merge/term_merger.rs b/crates/tantivy/src/columnar/columnar/merge/term_merger.rs
index a3a20249..f92fd580 100644
--- a/crates/tantivy/src/columnar/columnar/merge/term_merger.rs
+++ b/crates/tantivy/src/columnar/columnar/merge/term_merger.rs
@@ -10,16 +10,16 @@ pub struct HeapItem<'a> {
pub segment_ord: usize,
}
-impl<'a> PartialEq for HeapItem<'a> {
+impl PartialEq for HeapItem<'_> {
fn eq(&self, other: &Self) -> bool {
self.segment_ord == other.segment_ord
}
}
-impl<'a> Eq for HeapItem<'a> {}
+impl Eq for HeapItem<'_> {}
-impl<'a> PartialOrd for HeapItem<'a> {
- fn partial_cmp(&self, other: &HeapItem<'a>) -> Option<Ordering> {
+impl PartialOrd for HeapItem<'_> {
+ fn partial_cmp(&self, other: &HeapItem<'_>) -> Option<Ordering> {
Some(self.cmp(other))
}
}
diff --git a/crates/tantivy/src/columnar/columnar/writer/serializer.rs b/crates/tantivy/src/columnar/columnar/writer/serializer.rs
index 627fea20..d93f95c4 100644
--- a/crates/tantivy/src/columnar/columnar/writer/serializer.rs
+++ b/crates/tantivy/src/columnar/columnar/writer/serializer.rs
@@ -72,7 +72,7 @@ pub struct ColumnSerializer<'a, W: io::Write> {
start_offset: u64,
}
-impl<'a, W: io::Write> ColumnSerializer<'a, W> {
+impl<W: io::Write> ColumnSerializer<'_, W> {
pub fn finalize(self) -> io::Result<()> {
let end_offset: u64 = self.columnar_serializer.wrt.written_bytes();
let byte_range = self.start_offset..end_offset;
@@ -85,7 +85,7 @@ impl<'a, W: io::Write> ColumnSerializer<'a, W> {
}
}
-impl<'a, W: io::Write> io::Write for ColumnSerializer<'a, W> {
+impl<W: io::Write> io::Write for ColumnSerializer<'_, W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.columnar_serializer.wrt.write(buf)
}
diff --git a/crates/tantivy/src/columnar/iterable.rs b/crates/tantivy/src/columnar/iterable.rs
index ec9c8866..7c01b248 100644
--- a/crates/tantivy/src/columnar/iterable.rs
+++ b/crates/tantivy/src/columnar/iterable.rs
@@ -4,14 +4,15 @@ pub trait Iterable<T = u64> {
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_>;
}
-impl<'a, T: Copy> Iterable<T> for &'a [T] {
+impl<T: Copy> Iterable<T> for &[T] {
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_> {
Box::new(self.iter().copied())
}
}
impl<T: Copy> Iterable<T> for Range<T>
-where Range<T>: Iterator<Item = T>
+where
+ Range<T>: Iterator<Item = T>,
{
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_> {
Box::new(self.clone())
diff --git a/crates/tantivy/src/common/writer.rs b/crates/tantivy/src/common/writer.rs
index 88457687..3c880c68 100644
--- a/crates/tantivy/src/common/writer.rs
+++ b/crates/tantivy/src/common/writer.rs
@@ -65,7 +65,9 @@ pub struct AntiCallToken(());
pub trait TerminatingWrite: Write + Send + Sync {
/// Indicate that the writer will no longer be used. Internally call terminate_ref.
fn terminate(mut self) -> io::Result<()>
- where Self: Sized {
+ where
+ Self: Sized,
+ {
self.terminate_ref(AntiCallToken(()))
}
@@ -87,7 +89,7 @@ impl<W: TerminatingWrite> TerminatingWrite for BufWriter<W> {
}
}
-impl<'a> TerminatingWrite for &'a mut Vec<u8> {
+impl TerminatingWrite for &mut Vec<u8> {
fn terminate_ref(&mut self, _a: AntiCallToken) -> io::Result<()> {
self.flush()
}
diff --git a/crates/tantivy/src/docset.rs b/crates/tantivy/src/docset.rs
index 04ca4209..525d8517 100644
--- a/crates/tantivy/src/docset.rs
+++ b/crates/tantivy/src/docset.rs
@@ -99,7 +99,7 @@ pub trait DocSet: Send {
}
}
-impl<'a> DocSet for &'a mut dyn DocSet {
+impl DocSet for &mut dyn DocSet {
fn advance(&mut self) -> u32 {
(**self).advance()
}
diff --git a/crates/tantivy/src/indexer/merger.rs b/crates/tantivy/src/indexer/merger.rs
index 0be315a6..539b89b3 100644
--- a/crates/tantivy/src/indexer/merger.rs
+++ b/crates/tantivy/src/indexer/merger.rs
@@ -707,13 +707,13 @@ struct PeekSegmentPostingsWithNewDocId<'a> {
doc_id_mapping: &'a [Option<DocId>],
}
-impl<'a> DerefMut for PeekSegmentPostingsWithNewDocId<'a> {
+impl DerefMut for PeekSegmentPostingsWithNewDocId<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.segment
}
}
-impl<'a> Deref for PeekSegmentPostingsWithNewDocId<'a> {
+impl Deref for PeekSegmentPostingsWithNewDocId<'_> {
type Target = SegmentPostingsWithNewDocId;
fn deref(&self) -> &Self::Target {
@@ -721,7 +721,7 @@ impl<'a> Deref for PeekSegmentPostingsWithNewDocId<'a> {
}
}
-impl<'a> Drop for PeekSegmentPostingsWithNewDocId<'a> {
+impl Drop for PeekSegmentPostingsWithNewDocId<'_> {
fn drop(&mut self) {
self.segment.postings.advance();
self.segment.new_doc_id = if self.segment.postings.doc() == TERMINATED {
diff --git a/crates/tantivy/src/macros.rs b/crates/tantivy/src/macros.rs
index 119fdb11..b94fd4c9 100644
--- a/crates/tantivy/src/macros.rs
+++ b/crates/tantivy/src/macros.rs
@@ -41,7 +41,6 @@
/// );
/// # }
/// ```
-
#[macro_export]
macro_rules! doc(
() => {
diff --git a/crates/tantivy/src/postings/recorder.rs b/crates/tantivy/src/postings/recorder.rs
index 70cc954a..1f1b7673 100644
--- a/crates/tantivy/src/postings/recorder.rs
+++ b/crates/tantivy/src/postings/recorder.rs
@@ -35,7 +35,7 @@ impl<'a> VInt32Reader<'a> {
}
}
-impl<'a> Iterator for VInt32Reader<'a> {
+impl Iterator for VInt32Reader<'_> {
type Item = u32;
fn next(&mut self) -> Option<u32> {
diff --git a/crates/tantivy/src/query/boolean_query/block_wand.rs b/crates/tantivy/src/query/boolean_query/block_wand.rs
index ad9a8b2b..abe0bb16 100644
--- a/crates/tantivy/src/query/boolean_query/block_wand.rs
+++ b/crates/tantivy/src/query/boolean_query/block_wand.rs
@@ -272,7 +272,7 @@ impl<'a> From<&'a mut TermScorer> for TermScorerWithMaxScore<'a> {
}
}
-impl<'a> Deref for TermScorerWithMaxScore<'a> {
+impl Deref for TermScorerWithMaxScore<'_> {
type Target = TermScorer;
fn deref(&self) -> &Self::Target {
@@ -280,7 +280,7 @@ impl<'a> Deref for TermScorerWithMaxScore<'a> {
}
}
-impl<'a> DerefMut for TermScorerWithMaxScore<'a> {
+impl DerefMut for TermScorerWithMaxScore<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.scorer
}
diff --git a/crates/tantivy/src/schema/document/default_document.rs b/crates/tantivy/src/schema/document/default_document.rs
index 1fa81199..ae41e15b 100644
--- a/crates/tantivy/src/schema/document/default_document.rs
+++ b/crates/tantivy/src/schema/document/default_document.rs
@@ -401,7 +401,7 @@ impl PartialEq for CompactDocValue<'_> {
value1 == value2
}
}
-impl<'a> From<CompactDocValue<'a>> for OwnedValue {
+impl From<CompactDocValue<'_>> for OwnedValue {
fn from(value: CompactDocValue) -> Self {
value.as_value().into()
}
diff --git a/crates/tantivy/src/sstable/streamer.rs b/crates/tantivy/src/sstable/streamer.rs
index 1e01476f..dcf521d8 100644
--- a/crates/tantivy/src/sstable/streamer.rs
+++ b/crates/tantivy/src/sstable/streamer.rs
@@ -161,7 +161,7 @@ where
_lifetime: std::marker::PhantomData<&'a ()>,
}
-impl<'a, TSSTable> Streamer<'a, TSSTable, AlwaysMatch>
+impl<TSSTable> Streamer<'_, TSSTable, AlwaysMatch>
where
TSSTable: SSTable,
{
@@ -179,7 +179,7 @@ where
}
}
-impl<'a, TSSTable, A> Streamer<'a, TSSTable, A>
+impl<TSSTable, A> Streamer<'_, TSSTable, A>
where
A: Automaton,
A::State: Clone,
diff --git a/crates/tantivy/src/stacker/expull.rs b/crates/tantivy/src/stacker/expull.rs
index 08b255c9..d05804ac 100644
--- a/crates/tantivy/src/stacker/expull.rs
+++ b/crates/tantivy/src/stacker/expull.rs
@@ -74,7 +74,7 @@ fn ensure_capacity<'a>(
eull.remaining_cap = allocate as u16;
}
-impl<'a> ExpUnrolledLinkedListWriter<'a> {
+impl ExpUnrolledLinkedListWriter<'_> {
#[inline]
pub fn write_u32_vint(&mut self, val: u32) {
let mut buf = [0u8; 8];
diff --git a/crates/tantivy/src/stacker/shared_arena_hashmap.rs b/crates/tantivy/src/stacker/shared_arena_hashmap.rs
index dff09cda..1f03bb90 100644
--- a/crates/tantivy/src/stacker/shared_arena_hashmap.rs
+++ b/crates/tantivy/src/stacker/shared_arena_hashmap.rs
@@ -153,7 +153,7 @@ impl SharedArenaHashMap {
}
#[inline]
- fn get_key_value<'a>(&'a self, addr: Addr, memory_arena: &'a MemoryArena) -> (&[u8], Addr) {
+ fn get_key_value<'a>(&'a self, addr: Addr, memory_arena: &'a MemoryArena) -> (&'a [u8], Addr) {
let data = memory_arena.slice_from(addr);
let key_bytes_len_bytes = unsafe { data.get_unchecked(..2) };
let key_bytes_len = u16::from_le_bytes(key_bytes_len_bytes.try_into().unwrap());
@@ -193,7 +193,7 @@ impl SharedArenaHashMap {
}
#[inline]
- pub fn iter<'a>(&'a self, memory_arena: &'a MemoryArena) -> Iter<'_> {
+ pub fn iter<'a>(&'a self, memory_arena: &'a MemoryArena) -> Iter<'a> {
Iter {
inner: self
.table
diff --git a/crates/tantivy/src/store/index/skip_index.rs b/crates/tantivy/src/store/index/skip_index.rs
index d42b25ae..8bab38fe 100644
--- a/crates/tantivy/src/store/index/skip_index.rs
+++ b/crates/tantivy/src/store/index/skip_index.rs
@@ -11,7 +11,7 @@ pub struct LayerCursor<'a> {
cursor: usize,
}
-impl<'a> Iterator for LayerCursor<'a> {
+impl Iterator for LayerCursor<'_> {
type Item = Checkpoint;
fn next(&mut self) -> Option<Checkpoint> {
diff --git a/crates/tantivy/src/termdict/fst_termdict/streamer.rs b/crates/tantivy/src/termdict/fst_termdict/streamer.rs
index a6093009..43378a52 100644
--- a/crates/tantivy/src/termdict/fst_termdict/streamer.rs
+++ b/crates/tantivy/src/termdict/fst_termdict/streamer.rs
@@ -80,7 +80,7 @@ where
current_value: TermInfo,
}
-impl<'a, A> TermStreamer<'a, A>
+impl<A> TermStreamer<'_, A>
where
A: Automaton,
{
@@ -135,11 +135,12 @@ where
}
}
-impl<'a, A> LendingIterator for TermStreamer<'a, A>
+impl<A> LendingIterator for TermStreamer<'_, A>
where
A: Automaton,
{
- type Item<'b> = (&'b [u8], &'b TermInfo)
+ type Item<'b>
+ = (&'b [u8], &'b TermInfo)
where
Self: 'b;
diff --git a/crates/tantivy/src/tokenizer/ascii_folding_filter.rs b/crates/tantivy/src/tokenizer/ascii_folding_filter.rs
index da8039e1..7267fb75 100644
--- a/crates/tantivy/src/tokenizer/ascii_folding_filter.rs
+++ b/crates/tantivy/src/tokenizer/ascii_folding_filter.rs
@@ -42,7 +42,7 @@ pub struct AsciiFoldingFilterTokenStream<'a, T> {
tail: T,
}
-impl<'a, T: TokenStream> TokenStream for AsciiFoldingFilterTokenStream<'a, T> {
+impl<T: TokenStream> TokenStream for AsciiFoldingFilterTokenStream<'_, T> {
fn advance(&mut self) -> bool {
if !self.tail.advance() {
return false;
diff --git a/crates/tantivy/src/tokenizer/lower_caser.rs b/crates/tantivy/src/tokenizer/lower_caser.rs
index 56792ba8..02b42be6 100644
--- a/crates/tantivy/src/tokenizer/lower_caser.rs
+++ b/crates/tantivy/src/tokenizer/lower_caser.rs
@@ -51,7 +51,7 @@ fn to_lowercase_unicode(text: &str, output: &mut String) {
}
}
-impl<'a, T: TokenStream> TokenStream for LowerCaserTokenStream<'a, T> {
+impl<T: TokenStream> TokenStream for LowerCaserTokenStream<'_, T> {
fn advance(&mut self) -> bool {
if !self.tail.advance() {
return false;
diff --git a/crates/tantivy/src/tokenizer/ngram_tokenizer.rs b/crates/tantivy/src/tokenizer/ngram_tokenizer.rs
index 286e26c1..572d536d 100644
--- a/crates/tantivy/src/tokenizer/ngram_tokenizer.rs
+++ b/crates/tantivy/src/tokenizer/ngram_tokenizer.rs
@@ -160,7 +160,7 @@ impl Tokenizer for NgramTokenizer {
}
}
-impl<'a> TokenStream for NgramTokenStream<'a> {
+impl TokenStream for NgramTokenStream<'_> {
fn advance(&mut self) -> bool {
if let Some((offset_from, offset_to)) = self.ngram_charidx_iterator.next() {
if self.prefix_only && offset_from > 0 {
@@ -286,7 +286,7 @@ impl<'a> CodepointFrontiers<'a> {
}
}
-impl<'a> Iterator for CodepointFrontiers<'a> {
+impl Iterator for CodepointFrontiers<'_> {
type Item = usize;
fn next(&mut self) -> Option<usize> {
diff --git a/crates/tantivy/src/tokenizer/raw_tokenizer.rs b/crates/tantivy/src/tokenizer/raw_tokenizer.rs
index 9bf7ee22..dc918bcc 100644
--- a/crates/tantivy/src/tokenizer/raw_tokenizer.rs
+++ b/crates/tantivy/src/tokenizer/raw_tokenizer.rs
@@ -28,7 +28,7 @@ impl Tokenizer for RawTokenizer {
}
}
-impl<'a> TokenStream for RawTokenStream<'a> {
+impl TokenStream for RawTokenStream<'_> {
fn advance(&mut self) -> bool {
let result = self.has_token;
self.has_token = false;
diff --git a/crates/tantivy/src/tokenizer/regex_tokenizer.rs b/crates/tantivy/src/tokenizer/regex_tokenizer.rs
index a771e42d..c29be467 100644
--- a/crates/tantivy/src/tokenizer/regex_tokenizer.rs
+++ b/crates/tantivy/src/tokenizer/regex_tokenizer.rs
@@ -85,7 +85,7 @@ pub struct RegexTokenStream<'a> {
cursor: usize,
}
-impl<'a> TokenStream for RegexTokenStream<'a> {
+impl TokenStream for RegexTokenStream<'_> {
fn advance(&mut self) -> bool {
let Some(regex_match) = self.regex.find(self.text) else {
return false;
diff --git a/crates/tantivy/src/tokenizer/simple_tokenizer.rs b/crates/tantivy/src/tokenizer/simple_tokenizer.rs
index 540dfac4..0bd00ecc 100644
--- a/crates/tantivy/src/tokenizer/simple_tokenizer.rs
+++ b/crates/tantivy/src/tokenizer/simple_tokenizer.rs
@@ -27,7 +27,7 @@ impl Tokenizer for SimpleTokenizer {
}
}
-impl<'a> SimpleTokenStream<'a> {
+impl SimpleTokenStream<'_> {
// search for the end of the current token.
fn search_token_end(&mut self) -> usize {
(&mut self.chars)
@@ -38,7 +38,7 @@ impl<'a> SimpleTokenStream<'a> {
}
}
-impl<'a> TokenStream for SimpleTokenStream<'a> {
+impl TokenStream for SimpleTokenStream<'_> {
fn advance(&mut self) -> bool {
self.token.text.clear();
self.token.position = self.token.position.wrapping_add(1);
diff --git a/crates/tantivy/src/tokenizer/split_compound_words.rs b/crates/tantivy/src/tokenizer/split_compound_words.rs
index bd729910..ad15fc33 100644
--- a/crates/tantivy/src/tokenizer/split_compound_words.rs
+++ b/crates/tantivy/src/tokenizer/split_compound_words.rs
@@ -124,7 +124,7 @@ pub struct SplitCompoundWordsTokenStream<'a, T> {
parts: &'a mut Vec<Token>,
}
-impl<'a, T: TokenStream> SplitCompoundWordsTokenStream<'a, T> {
+impl<T: TokenStream> SplitCompoundWordsTokenStream<'_, T> {
// Will use `self.cuts` to fill `self.parts` if `self.tail.token()`
// can fully be split into consecutive matches against `self.dict`.
fn split(&mut self) {
@@ -160,7 +160,7 @@ impl<'a, T: TokenStream> SplitCompoundWordsTokenStream<'a, T> {
}
}
-impl<'a, T: TokenStream> TokenStream for SplitCompoundWordsTokenStream<'a, T> {
+impl<T: TokenStream> TokenStream for SplitCompoundWordsTokenStream<'_, T> {
fn advance(&mut self) -> bool {
self.parts.pop();
diff --git a/crates/tantivy/src/tokenizer/whitespace_tokenizer.rs b/crates/tantivy/src/tokenizer/whitespace_tokenizer.rs
index 69a3b055..4f1951f6 100644
--- a/crates/tantivy/src/tokenizer/whitespace_tokenizer.rs
+++ b/crates/tantivy/src/tokenizer/whitespace_tokenizer.rs
@@ -26,7 +26,7 @@ impl Tokenizer for WhitespaceTokenizer {
}
}
-impl<'a> WhitespaceTokenStream<'a> {
+impl WhitespaceTokenStream<'_> {
// search for the end of the current token.
fn search_token_end(&mut self) -> usize {
(&mut self.chars)
@@ -37,7 +37,7 @@ impl<'a> WhitespaceTokenStream<'a> {
}
}
-impl<'a> TokenStream for WhitespaceTokenStream<'a> {
+impl TokenStream for WhitespaceTokenStream<'_> {
fn advance(&mut self) -> bool {
self.token.text.clear();
self.token.position = self.token.position.wrapping_add(1);
diff --git a/crates/tantivy/src/tokenizer_api/mod.rs b/crates/tantivy/src/tokenizer_api/mod.rs
index c788ea36..ac4c4d02 100644
--- a/crates/tantivy/src/tokenizer_api/mod.rs
+++ b/crates/tantivy/src/tokenizer_api/mod.rs
@@ -64,7 +64,7 @@ pub trait Tokenizer: 'static + Clone + Send + Sync {
/// Simple wrapper of `Box<dyn TokenStream + 'a>`.
pub struct BoxTokenStream<'a>(Box<dyn TokenStream + 'a>);
-impl<'a> TokenStream for BoxTokenStream<'a> {
+impl TokenStream for BoxTokenStream<'_> {
fn advance(&mut self) -> bool {
self.0.advance()
}
@@ -91,7 +91,7 @@ impl<'a> Deref for BoxTokenStream<'a> {
&*self.0
}
}
-impl<'a> DerefMut for BoxTokenStream<'a> {
+impl DerefMut for BoxTokenStream<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut *self.0
}
@@ -155,7 +155,8 @@ impl<'a, T> LendingIterator for TokenIter<'a, T>
where
T: TokenStream,
{
- type Item<'b> = &'b Token
+ type Item<'b>
+ = &'b Token
where
'a: 'b;
diff --git a/crates/zimba/src/lib.rs b/crates/zimba/src/lib.rs
index a79ce2df..b936abd1 100644
--- a/crates/zimba/src/lib.rs
+++ b/crates/zimba/src/lib.rs
@@ -449,7 +449,7 @@ enum CompressedReader<'a> {
Zstd(BufReader<zstd::Decoder<'a, BufReader<&'a [u8]>>>),
}
-impl<'a> std::io::Read for CompressedReader<'a> {
+impl std::io::Read for CompressedReader<'_> {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
match self {
CompressedReader::Uncompressed(reader) => reader.read(buf),
@@ -690,7 +690,7 @@ impl<'a> DirEntryIterator<'a> {
}
}
-impl<'a> Iterator for DirEntryIterator<'a> {
+impl Iterator for DirEntryIterator<'_> {
type Item = Result<DirEntry, Error>;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/crates/zimba/src/wiki.rs b/crates/zimba/src/wiki.rs
index 11e5fe60..dc6d9c9d 100644
--- a/crates/zimba/src/wiki.rs
+++ b/crates/zimba/src/wiki.rs
@@ -94,7 +94,7 @@ pub struct Article {
pub content: String,
}
-impl<'a> Iterator for ArticleIterator<'a> {
+impl Iterator for ArticleIterator<'_> {
type Item = Article;
fn next(&mut self) -> Option<Self::Item> {
@@ -216,7 +216,7 @@ impl Image {
}
}
-impl<'a> Iterator for ImageIterator<'a> {
+impl Iterator for ImageIterator<'_> {
type Item = Image;
fn next(&mut self) -> Option<Self::Item> {