Skip to content

Commit 02a5b6a

Browse files
authored
clippy (#5512)
1 parent 21cec26 commit 02a5b6a

File tree

27 files changed

+48
-45
lines changed

27 files changed

+48
-45
lines changed

quickwit/quickwit-actors/src/universe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::spawn_builder::{SpawnBuilder, SpawnContext};
2828
use crate::{Actor, ActorExitStatus, Command, Inbox, Mailbox, QueueCapacity};
2929

3030
/// Universe serves as the top-level context in which Actor can be spawned.
31+
///
3132
/// It is *not* a singleton. A typical application will usually have only one universe hosting all
3233
/// of the actors but it is not a requirement.
3334
///

quickwit/quickwit-cli/src/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ struct Printer<'a> {
12381238
pub stdout: &'a mut Stdout,
12391239
}
12401240

1241-
impl<'a> Printer<'a> {
1241+
impl Printer<'_> {
12421242
pub fn print_header(&mut self, header: &str) -> io::Result<()> {
12431243
write!(&mut self.stdout, " {}", header.bright_blue())?;
12441244
Ok(())

quickwit/quickwit-cli/src/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ struct Printer<'a> {
841841
pub stdout: &'a mut Stdout,
842842
}
843843

844-
impl<'a> Printer<'a> {
844+
impl Printer<'_> {
845845
pub fn print_header(&mut self, header: &str) -> io::Result<()> {
846846
write!(&mut self.stdout, " {}", header.bright_blue())?;
847847
Ok(())

quickwit/quickwit-common/src/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub struct GaugeGuard<'a> {
236236
delta: i64,
237237
}
238238

239-
impl<'a> std::fmt::Debug for GaugeGuard<'a> {
239+
impl std::fmt::Debug for GaugeGuard<'_> {
240240
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
241241
self.delta.fmt(f)
242242
}
@@ -262,7 +262,7 @@ impl<'a> GaugeGuard<'a> {
262262
}
263263
}
264264

265-
impl<'a> Drop for GaugeGuard<'a> {
265+
impl Drop for GaugeGuard<'_> {
266266
fn drop(&mut self) {
267267
self.gauge.sub(self.delta)
268268
}

quickwit/quickwit-common/src/sorted_iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ impl<T> SortedIterator for T where T: Iterator + Sorted {}
106106

107107
impl<K, V> Sorted for btree_map::IntoKeys<K, V> {}
108108
impl<K, V> Sorted for btree_map::IntoValues<K, V> {}
109-
impl<'a, K, V> Sorted for btree_map::Keys<'a, K, V> {}
110-
impl<'a, K, V> Sorted for btree_map::Values<'a, K, V> {}
109+
impl<K, V> Sorted for btree_map::Keys<'_, K, V> {}
110+
impl<K, V> Sorted for btree_map::Values<'_, K, V> {}
111111
impl<K> Sorted for btree_set::IntoIter<K> {}
112-
impl<'a, K> Sorted for btree_set::Iter<'a, K> {}
112+
impl<K> Sorted for btree_set::Iter<'_, K> {}
113113

114114
/// Same as [`SortedIterator`] but for (key, value) pairs sorted by key.
115115
pub trait SortedByKeyIterator<K, V>: Iterator + Sized {
@@ -194,7 +194,7 @@ where
194194
impl<T, K, V> SortedByKeyIterator<K, V> for T where T: Iterator<Item = (K, V)> + Sorted {}
195195

196196
impl<K, V> Sorted for btree_map::IntoIter<K, V> {}
197-
impl<'a, K, V> Sorted for btree_map::Iter<'a, K, V> {}
197+
impl<K, V> Sorted for btree_map::Iter<'_, K, V> {}
198198

199199
#[cfg(test)]
200200
mod tests {

quickwit/quickwit-common/src/temp_dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub struct Builder<'a> {
8282
num_rand_chars: usize,
8383
}
8484

85-
impl<'a> Default for Builder<'a> {
85+
impl Default for Builder<'_> {
8686
fn default() -> Self {
8787
Self {
8888
parts: Default::default(),

quickwit/quickwit-control-plane/src/indexing_scheduler/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ struct IndexingPlansDiff<'a> {
403403
pub unplanned_tasks_by_node_id: FnvHashMap<&'a str, Vec<&'a IndexingTask>>,
404404
}
405405

406-
impl<'a> IndexingPlansDiff<'a> {
406+
impl IndexingPlansDiff<'_> {
407407
pub fn has_same_nodes(&self) -> bool {
408408
self.missing_node_ids.is_empty() && self.unplanned_node_ids.is_empty()
409409
}
@@ -454,7 +454,7 @@ fn get_shard_locality_metrics(
454454
}
455455
}
456456

457-
impl<'a> fmt::Debug for IndexingPlansDiff<'a> {
457+
impl fmt::Debug for IndexingPlansDiff<'_> {
458458
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
459459
if self.has_same_nodes() && self.has_same_tasks() {
460460
return write!(formatter, "EmptyIndexingPlansDiff");

quickwit/quickwit-directories/src/bundle_directory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl Debug for BundleDirectory {
4949
}
5050

5151
/// Loads the split footer from a storage and path.
52+
///
5253
/// Returns (SplitFooter, BundleFooter)
5354
/// SplitFooter [BundleMetadata, BundleMetadata Len, Hotcache, Hotcache len]
5455
/// BundleFooter [BundleMetadata, BundleMetadata Len]

quickwit/quickwit-doc-mapper/src/query_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'a> ExtractTermSetFields<'a> {
146146
}
147147
}
148148

149-
impl<'a, 'b> QueryAstVisitor<'a> for ExtractTermSetFields<'b> {
149+
impl<'a> QueryAstVisitor<'a> for ExtractTermSetFields<'_> {
150150
type Err = anyhow::Error;
151151

152152
fn visit_term_set(&mut self, term_set_query: &'a TermSetQuery) -> anyhow::Result<()> {

quickwit/quickwit-indexing/src/actors/uploader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub enum UploaderType {
6868
}
6969

7070
/// [`SplitsUpdateMailbox`] wraps either a [`Mailbox<Sequencer>`] or [`Mailbox<Publisher>`].
71+
///
7172
/// It makes it possible to send a [`SplitsUpdate`] either to the [`Sequencer`] or directly
7273
/// to [`Publisher`]. It is used in combination with `SplitsUpdateSender` that will do the send.
7374
///

quickwit/quickwit-indexing/src/merge_policy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pub fn nop_merge_policy() -> Arc<dyn MergePolicy> {
203203

204204
struct SplitShortDebug<'a>(&'a SplitMetadata);
205205

206-
impl<'a> fmt::Debug for SplitShortDebug<'a> {
206+
impl fmt::Debug for SplitShortDebug<'_> {
207207
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
208208
f.debug_struct("Split")
209209
.field("split_id", &self.0.split_id())

quickwit/quickwit-indexing/src/merge_policy/stable_log_merge_policy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl StableLogMergePolicy {
356356
head + (self.config.merge_factor - 2)
357357
};
358358
if tail.is_empty() || num_docs <= first_level_min_saturation_docs as u64 {
359-
return (num_docs as usize + head - 1) / head;
359+
return (num_docs as usize).div_ceil(head);
360360
}
361361
num_docs -= first_level_min_saturation_docs as u64;
362362
self.config.merge_factor - 1 + self.max_num_splits_knowning_levels(num_docs, tail, sorted)

quickwit/quickwit-metastore/src/metastore/file_backed/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ mod tests {
19151915
}
19161916
indexes_json_valid_put -= 1;
19171917
}
1918-
return block_on(ram_storage_clone.put(path, put_payload));
1918+
block_on(ram_storage_clone.put(path, put_payload))
19191919
});
19201920
let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage));
19211921
let index_config = IndexConfig::for_test(index_id, "ram:///indexes/test-index");
@@ -1967,9 +1967,7 @@ mod tests {
19671967
mock_storage
19681968
.expect_put()
19691969
.times(1)
1970-
.returning(move |path, put_payload| {
1971-
return block_on(ram_storage_clone.put(path, put_payload));
1972-
});
1970+
.returning(move |path, put_payload| block_on(ram_storage_clone.put(path, put_payload)));
19731971
let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage));
19741972

19751973
// Delete index
@@ -2024,7 +2022,7 @@ mod tests {
20242022
}
20252023
indexes_json_valid_put -= 1;
20262024
}
2027-
return block_on(ram_storage_clone.put(path, put_payload));
2025+
block_on(ram_storage_clone.put(path, put_payload))
20282026
});
20292027
let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage));
20302028

quickwit/quickwit-proto/src/codegen/jaeger/jaeger.api_v2.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-proto/src/codegen/quickwit/quickwit.search.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-proto/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl TryFrom<metastore::DeleteQuery> for search::SearchRequest {
144144
/// `MutMetadataMap` used to extract [`tonic::metadata::MetadataMap`] from a request.
145145
pub struct MutMetadataMap<'a>(&'a mut tonic::metadata::MetadataMap);
146146

147-
impl<'a> Injector for MutMetadataMap<'a> {
147+
impl Injector for MutMetadataMap<'_> {
148148
/// Sets a key-value pair in the [`MetadataMap`]. No-op if the key or value is invalid.
149149
fn set(&mut self, key: &str, value: String) {
150150
if let Ok(metadata_key) = tonic::metadata::MetadataKey::from_bytes(key.as_bytes()) {
@@ -155,7 +155,7 @@ impl<'a> Injector for MutMetadataMap<'a> {
155155
}
156156
}
157157

158-
impl<'a> Extractor for MutMetadataMap<'a> {
158+
impl Extractor for MutMetadataMap<'_> {
159159
/// Gets a value for a key from the MetadataMap. If the value can't be converted to &str,
160160
/// returns None.
161161
fn get(&self, key: &str) -> Option<&str> {
@@ -195,7 +195,7 @@ impl Interceptor for SpanContextInterceptor {
195195
/// tracing keys from request's headers.
196196
struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap);
197197

198-
impl<'a> Extractor for MetadataMap<'a> {
198+
impl Extractor for MetadataMap<'_> {
199199
/// Gets a value for a key from the MetadataMap. If the value can't be converted to &str,
200200
/// returns None.
201201
fn get(&self, key: &str) -> Option<&str> {

quickwit/quickwit-query/src/json_literal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<'a> InterpretUserInput<'a> for f64 {
129129
}
130130
}
131131

132-
impl<'a> InterpretUserInput<'a> for bool {
132+
impl InterpretUserInput<'_> for bool {
133133
fn interpret_bool(b: bool) -> Option<Self> {
134134
Some(b)
135135
}
@@ -139,14 +139,14 @@ impl<'a> InterpretUserInput<'a> for bool {
139139
}
140140
}
141141

142-
impl<'a> InterpretUserInput<'a> for Ipv6Addr {
142+
impl InterpretUserInput<'_> for Ipv6Addr {
143143
fn interpret_str(text: &str) -> Option<Self> {
144144
let ip_addr: IpAddr = text.parse().ok()?;
145145
Some(ip_addr.into_ipv6_addr())
146146
}
147147
}
148148

149-
impl<'a> InterpretUserInput<'a> for tantivy::DateTime {
149+
impl InterpretUserInput<'_> for tantivy::DateTime {
150150
fn interpret_str(text: &str) -> Option<Self> {
151151
let date_time_formats = get_default_date_time_format();
152152
if let Ok(datetime) = parse_date_time_str(text, date_time_formats) {
@@ -171,7 +171,7 @@ const LENIENT_BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::Ge
171171
.with_decode_padding_mode(base64::engine::DecodePaddingMode::Indifferent),
172172
);
173173

174-
impl<'a> InterpretUserInput<'a> for Vec<u8> {
174+
impl InterpretUserInput<'_> for Vec<u8> {
175175
fn interpret_str(mut text: &str) -> Option<Vec<u8>> {
176176
let Some(first_byte) = text.as_bytes().first().copied() else {
177177
return Some(Vec::new());

quickwit/quickwit-query/src/tokenizers/chinese_compatible.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn char_grouping(c: char) -> Grouping {
7979
}
8080
}
8181

82-
impl<'a> TokenStream for ChineseTokenStream<'a> {
82+
impl TokenStream for ChineseTokenStream<'_> {
8383
fn advance(&mut self) -> bool {
8484
self.token.text.clear();
8585
self.token.position = self.token.position.wrapping_add(1);

quickwit/quickwit-query/src/tokenizers/code_tokenizer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ enum AdvanceResult {
7676
Backtrack,
7777
}
7878

79-
impl<'a> CodeTokenStream<'a> {
79+
impl CodeTokenStream<'_> {
8080
fn advance_inner(&mut self, enable_hex: bool) -> bool {
8181
// this is cheap, just a copy of a few ptrs and integers
8282
let checkpoint = self.chars.clone();
@@ -116,7 +116,7 @@ impl<'a> CodeTokenStream<'a> {
116116
}
117117
}
118118

119-
impl<'a> TokenStream for CodeTokenStream<'a> {
119+
impl TokenStream for CodeTokenStream<'_> {
120120
fn advance(&mut self) -> bool {
121121
self.token.text.clear();
122122
self.token.position = self.token.position.wrapping_add(1);
@@ -133,7 +133,7 @@ impl<'a> TokenStream for CodeTokenStream<'a> {
133133
}
134134
}
135135

136-
impl<'a> CodeTokenStream<'a> {
136+
impl CodeTokenStream<'_> {
137137
fn update_token(&mut self, token_offsets: Range<usize>) {
138138
self.token.offset_from = token_offsets.start;
139139
self.token.offset_to = token_offsets.end;

quickwit/quickwit-query/src/tokenizers/multilang.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub enum MultiLanguageTokenStream<'a> {
153153
Simple(SimpleTokenStream<'a>),
154154
}
155155

156-
impl<'a> TokenStream for MultiLanguageTokenStream<'a> {
156+
impl TokenStream for MultiLanguageTokenStream<'_> {
157157
fn advance(&mut self) -> bool {
158158
match self {
159159
MultiLanguageTokenStream::Empty => false,
@@ -188,7 +188,7 @@ pub struct LinderaTokenStream<'a> {
188188
pub token: &'a mut Token,
189189
}
190190

191-
impl<'a> TokenStream for LinderaTokenStream<'a> {
191+
impl TokenStream for LinderaTokenStream<'_> {
192192
fn advance(&mut self) -> bool {
193193
if self.tokens.is_empty() {
194194
return false;

quickwit/quickwit-search/src/leaf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ struct RemoveTimestampRange<'a> {
717717
end_timestamp: Bound<DateTime>,
718718
}
719719

720-
impl<'a> RemoveTimestampRange<'a> {
720+
impl RemoveTimestampRange<'_> {
721721
fn update_start_timestamp(
722722
&mut self,
723723
lower_bound: &quickwit_query::JsonLiteral,
@@ -755,7 +755,7 @@ impl<'a> RemoveTimestampRange<'a> {
755755
}
756756
}
757757

758-
impl<'a> QueryAstTransformer for RemoveTimestampRange<'a> {
758+
impl QueryAstTransformer for RemoveTimestampRange<'_> {
759759
type Err = std::convert::Infallible;
760760

761761
fn transform_bool(&mut self, mut bool_query: BoolQuery) -> Result<Option<QueryAst>, Self::Err> {

quickwit/quickwit-search/src/retry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<Request, Response, Error> RetryPolicy<Request, Response, Error> for Default
5555
}
5656
}
5757

58-
impl<'a> Job for &'a str {
58+
impl Job for &str {
5959
fn split_id(&self) -> &str {
6060
self
6161
}

quickwit/quickwit-search/src/root.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ struct ExtractTimestampRange<'a> {
14481448
end_timestamp: Option<i64>,
14491449
}
14501450

1451-
impl<'a> ExtractTimestampRange<'a> {
1451+
impl ExtractTimestampRange<'_> {
14521452
fn update_start_timestamp(
14531453
&mut self,
14541454
lower_bound: &quickwit_query::JsonLiteral,
@@ -1489,7 +1489,7 @@ impl<'a> ExtractTimestampRange<'a> {
14891489
}
14901490
}
14911491

1492-
impl<'a, 'b> QueryAstVisitor<'b> for ExtractTimestampRange<'a> {
1492+
impl<'b> QueryAstVisitor<'b> for ExtractTimestampRange<'_> {
14931493
type Err = std::convert::Infallible;
14941494

14951495
fn visit_bool(&mut self, bool_query: &'b BoolQuery) -> Result<(), Self::Err> {

quickwit/quickwit-search/src/search_stream/leaf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,10 @@ impl std::fmt::Display for SearchStreamRequestFields {
362362
}
363363
}
364364

365-
impl<'a> SearchStreamRequestFields {
365+
impl SearchStreamRequestFields {
366366
pub fn from_request(
367367
stream_request: &SearchStreamRequest,
368-
schema: &'a Schema,
368+
schema: &Schema,
369369
doc_mapper: &DocMapper,
370370
) -> crate::Result<SearchStreamRequestFields> {
371371
let fast_field = schema.get_field(&stream_request.fast_field)?;

quickwit/quickwit-search/src/top_k_collector.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ where
508508
}
509509
}
510510

511-
impl<'a, V1, V2, const REVERSE_DOCID: bool> Iterator
512-
for SpecSortingFieldIter<'a, V1, V2, REVERSE_DOCID>
511+
impl<V1, V2, const REVERSE_DOCID: bool> Iterator for SpecSortingFieldIter<'_, V1, V2, REVERSE_DOCID>
513512
where
514513
V1: Copy + PartialEq + Eq + PartialOrd + Ord + IntoOptionU64 + Debug,
515514
V2: Copy + PartialEq + Eq + PartialOrd + Ord + IntoOptionU64 + Debug,

quickwit/quickwit-serve/src/rest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ fn api_v1_routes(
294294
}
295295

296296
/// This function returns a formatted error based on the given rejection reason.
297+
///
297298
/// The ordering of rejection processing is very important, we need to start
298299
/// with the most specific rejections and end with the most generic. If not, Quickwit
299300
/// will return useless errors to the user.

0 commit comments

Comments
 (0)