Skip to content

Commit

Permalink
Update Rust version to 1.77 (#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilload committed Apr 1, 2024
1 parent 3ead65a commit 2402e67
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 32 deletions.
3 changes: 0 additions & 3 deletions quickwit/quickwit-actors/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,6 @@ impl Handler<AddOperand> for Adder {
}
}

#[derive(Debug)]
struct Sleep(Duration);

#[tokio::test]
async fn test_actor_return_response() -> anyhow::Result<()> {
let universe = Universe::with_accelerated_time();
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ pub mod busy_detector {

// LAST_UNPARK_TIMESTAMP and NEXT_DEBUG_TIMESTAMP are semantically micro-second
// precision timestamps, but we use atomics to allow accessing them without locks.
thread_local!(static LAST_UNPARK_TIMESTAMP: AtomicU64 = AtomicU64::new(0));
thread_local!(static LAST_UNPARK_TIMESTAMP: AtomicU64 = const { AtomicU64::new(0) });
static NEXT_DEBUG_TIMESTAMP: AtomicU64 = AtomicU64::new(0);
static SUPPRESSED_DEBUG_COUNT: AtomicU64 = AtomicU64::new(0);

Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-common/src/stream_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ where T: RpcName
}
}

pub struct InFlightValue<T>(T, GaugeGuard);
pub struct InFlightValue<T>(T, #[allow(dead_code)] GaugeGuard);

impl<T> fmt::Debug for InFlightValue<T>
where T: fmt::Debug
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-control-plane/src/ingest/wait_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl WaitHandle {
}
}

pub struct WaitDropGuard(oneshot::Sender<()>);
pub struct WaitDropGuard(#[allow(dead_code)] oneshot::Sender<()>);

#[cfg(test)]
mod tests {
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-directories/src/hot_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl StaticDirectoryCache {
}

pub fn get_file_length(&self, path: &Path) -> Option<u64> {
self.file_lengths.get(path).map(u64::clone)
self.file_lengths.get(path).copied()
}

/// return the files and their cached lengths
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-ingest/src/ingest_v2/debouncing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Debouncer {
}

#[derive(Debug)]
pub(super) struct PermitGuard(OwnedRwLockWriteGuard<()>);
pub(super) struct PermitGuard(#[allow(dead_code)] OwnedRwLockWriteGuard<()>);

#[derive(Debug)]
pub(super) struct BarrierGuard(Arc<RwLock<()>>);
Expand Down
4 changes: 1 addition & 3 deletions quickwit/quickwit-ingest/src/ingest_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ impl IngestRequestV2Builder {
.into_iter()
.enumerate()
.flat_map(|(subrequest_id, (index_id, doc_batch_builder))| {
let Some(doc_batch) = doc_batch_builder.build() else {
return None;
};
let doc_batch = doc_batch_builder.build()?;
let ingest_subrequest = IngestSubrequest {
subrequest_id: subrequest_id as u32,
index_id,
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-ingest/src/ingest_v2/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ mod tests {
let subworkbench = workbench.subworkbenches.get(&0).unwrap();
assert!(matches!(
&subworkbench.last_failure_opt,
Some(SubworkbenchFailure::Internal(msg)) if msg.contains("internal")
Some(SubworkbenchFailure::Internal)
));

assert!(!workbench
Expand Down
19 changes: 9 additions & 10 deletions quickwit/quickwit-ingest/src/ingest_v2/workbench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl IngestWorkbench {
"failure reason for subrequest `{}` is unspecified",
open_shards_failure.subrequest_id
);
SubworkbenchFailure::Internal("unspecified failure reason".to_string())
SubworkbenchFailure::Internal
}
};
self.record_failure(open_shards_failure.subrequest_id, last_failure);
Expand Down Expand Up @@ -164,7 +164,7 @@ impl IngestWorkbench {
| IngestV2Error::ShardNotFound { .. }
| IngestV2Error::TooManyRequests => {
for subrequest_id in persist_summary.subrequest_ids {
self.record_internal_error(subrequest_id, persist_error.to_string());
self.record_internal_error(subrequest_id);
}
}
}
Expand Down Expand Up @@ -195,8 +195,8 @@ impl IngestWorkbench {
self.record_failure(subrequest_id, SubworkbenchFailure::Unavailable);
}

fn record_internal_error(&mut self, subrequest_id: SubrequestId, error_message: String) {
self.record_failure(subrequest_id, SubworkbenchFailure::Internal(error_message));
fn record_internal_error(&mut self, subrequest_id: SubrequestId) {
self.record_failure(subrequest_id, SubworkbenchFailure::Internal);
}

pub fn into_ingest_result(self) -> IngestV2Result<IngestResponseV2> {
Expand Down Expand Up @@ -277,7 +277,7 @@ pub(super) enum SubworkbenchFailure {
// This is an error returned by the ingester: e.g. shard not found, shard closed, rate
// limited, resource exhausted, etc.
Persist(PersistFailureReason),
Internal(String),
Internal,
// The ingester is no longer in the pool or a transport error occurred.
Unavailable,
}
Expand All @@ -288,7 +288,7 @@ impl SubworkbenchFailure {
match self {
Self::IndexNotFound => IngestFailureReason::IndexNotFound,
Self::SourceNotFound => IngestFailureReason::SourceNotFound,
Self::Internal(_) => IngestFailureReason::Internal,
Self::Internal => IngestFailureReason::Internal,
Self::NoShardsAvailable => IngestFailureReason::NoShardsAvailable,
// In our last attempt, we did not manage to reach the ingester.
// We can consider that as a no shards available.
Expand Down Expand Up @@ -327,7 +327,7 @@ impl IngestSubworkbench {
match self.last_failure_opt {
Some(SubworkbenchFailure::IndexNotFound) => false,
Some(SubworkbenchFailure::SourceNotFound) => false,
Some(SubworkbenchFailure::Internal(_)) => true,
Some(SubworkbenchFailure::Internal) => true,
Some(SubworkbenchFailure::NoShardsAvailable) => true,
Some(SubworkbenchFailure::Persist(_)) => true,
Some(SubworkbenchFailure::Unavailable) => true,
Expand Down Expand Up @@ -356,8 +356,7 @@ mod tests {
assert!(subworkbench.is_pending());
assert!(subworkbench.last_failure_is_transient());

subworkbench.last_failure_opt =
Some(SubworkbenchFailure::Internal("internal error".to_string()));
subworkbench.last_failure_opt = Some(SubworkbenchFailure::Internal);
assert!(subworkbench.is_pending());
assert!(subworkbench.last_failure_is_transient());

Expand Down Expand Up @@ -604,7 +603,7 @@ mod tests {

assert!(matches!(
&subworkbench.last_failure_opt,
Some(SubworkbenchFailure::Internal(message)) if message.contains("IO error")
Some(SubworkbenchFailure::Internal)
));
assert!(subworkbench.persist_success_opt.is_none());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl LazyFileBackedIndex {
)
})
.await
.map(|index| index.clone())
.cloned()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct PostgresqlMetastoreFactory {
impl PostgresqlMetastoreFactory {
async fn get_from_cache(&self, uri: &Uri) -> Option<MetastoreServiceClient> {
let cache_lock = self.cache.lock().await;
cache_lock.get(uri).map(MetastoreServiceClient::clone)
cache_lock.get(uri).cloned()
}

/// If there is a valid entry in the cache to begin with, we trash the new
Expand Down
9 changes: 2 additions & 7 deletions quickwit/quickwit-search/src/top_k_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,12 @@ pub(crate) struct SearchAfterSegment {
}
impl SearchAfterSegment {
pub fn new(
search_after: Option<PartialHit>,
search_after_opt: Option<PartialHit>,
sort_order1: SortOrder,
sort_order2: SortOrder,
score_extractor: &SortingFieldExtractorPair,
) -> Option<Self> {
let Some(search_after) = search_after else {
return None;
};

let search_after = search_after_opt?;
let mut sort_value = None;
if let Some(search_after_sort_value) = search_after
.sort_value
Expand All @@ -856,7 +853,6 @@ impl SearchAfterSegment {
return None;
}
}

let mut sort_value2 = None;
if let Some(search_after_sort_value) = search_after
.sort_value2
Expand All @@ -872,7 +868,6 @@ impl SearchAfterSegment {
sort_value2 = Some(new_value);
}
}

Some(Self {
sort_value,
sort_value2,
Expand Down
2 changes: 1 addition & 1 deletion quickwit/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.76"
channel = "1.77"
components = ["cargo", "clippy", "rustfmt", "rust-docs"]

0 comments on commit 2402e67

Please sign in to comment.