Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
guilload committed May 16, 2024
1 parent 7b0dbec commit fe0d3af
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion quickwit/quickwit-cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl RunCliCommand {

if let Some(services) = &self.services {
info!(services = %services.iter().join(", "), "setting services from override");
node_config.enabled_services = services.clone();
node_config.enabled_services.clone_from(services);
}
let telemetry_handle_opt =
quickwit_telemetry::start_telemetry_loop(quickwit_telemetry_info(&node_config));
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-control-plane/src/debouncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Debouncer {

pub fn self_send_with_cooldown<M>(
&self,
ctx: &ActorContext<impl Actor + Handler<M> + DeferableReplyHandler<M>>,
ctx: &ActorContext<impl Handler<M> + DeferableReplyHandler<M>>,
) where
M: Default + std::fmt::Debug + Send + Sync + 'static,
{
Expand Down
5 changes: 3 additions & 2 deletions quickwit/quickwit-indexing/src/actors/indexing_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl IndexingPipeline {
.set_num_spawn_attempts(self.statistics.num_spawn_attempts);
let pipeline_metrics_opt = handles.indexer.last_observation().pipeline_metrics_opt;
self.statistics.pipeline_metrics_opt = pipeline_metrics_opt;
self.statistics.shard_ids = self.shard_ids.clone();
self.statistics.shard_ids.clone_from(&self.shard_ids);
ctx.observe(self);
}

Expand Down Expand Up @@ -543,7 +543,8 @@ impl Handler<AssignShards> for IndexingPipeline {
assign_shards_message: AssignShards,
ctx: &ActorContext<Self>,
) -> Result<(), ActorExitStatus> {
self.shard_ids = assign_shards_message.0.shard_ids.clone();
self.shard_ids
.clone_from(&assign_shards_message.0.shard_ids);
// If the pipeline is running, we forward the message to its source.
// If it is not, it will be respawned soon, and the shards will be assigned afterward.
if let Some(handles) = &mut self.handles_opt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ pub fn build_node_configs(
let unique_dir_name = new_coolid("test-dir");
for (node_idx, node_services) in nodes_services.iter().enumerate() {
let mut config = NodeConfig::for_test();
config.enabled_services = node_services.clone();
config.cluster_id = cluster_id.clone();
config.enabled_services.clone_from(node_services);
config.cluster_id.clone_from(&cluster_id);
config.node_id = NodeId::new(format!("test-node-{node_idx}"));
config.data_dir_path = root_data_dir.join(config.node_id.as_str());
config.metastore_uri =
Expand Down
8 changes: 4 additions & 4 deletions quickwit/quickwit-metastore/src/metastore/postgres/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ where for<'c> &'c mut DB::Connection: Executor<'c, Database = DB>
{
type Database = DB;

fn fetch_many<'e, 'q: 'e, E: 'q>(
fn fetch_many<'e, 'q: 'e, E>(
self,
query: E,
) -> BoxStream<'e, Result<Either<DB::QueryResult, DB::Row>, Error>>
where
E: Execute<'q, Self::Database>,
E: Execute<'q, Self::Database> + 'q,
{
self.inner_pool.fetch_many(query)
}

fn fetch_optional<'e, 'q: 'e, E: 'q>(
fn fetch_optional<'e, 'q: 'e, E>(
self,
query: E,
) -> BoxFuture<'e, Result<Option<DB::Row>, Error>>
where
E: Execute<'q, Self::Database>,
E: Execute<'q, Self::Database> + 'q,
{
self.inner_pool.fetch_optional(query)
}
Expand Down
8 changes: 5 additions & 3 deletions quickwit/quickwit-search/src/scroll_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use std::collections::HashMap;
use std::fmt;
use std::ops::Range;
use std::str::FromStr;
use std::sync::Arc;
Expand Down Expand Up @@ -192,15 +193,16 @@ impl ScrollKeyAndStartOffset {
}
}

impl ToString for ScrollKeyAndStartOffset {
fn to_string(&self) -> String {
impl fmt::Display for ScrollKeyAndStartOffset {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let mut payload = vec![0u8; 28];
payload[..16].copy_from_slice(&u128::from(self.scroll_ulid).to_le_bytes());
payload[16..24].copy_from_slice(&self.start_offset.to_le_bytes());
payload[24..28].copy_from_slice(&self.max_hits_per_page.to_le_bytes());
serde_json::to_writer(&mut payload, &self.search_after)
.expect("serializing PartialHit should never fail");
BASE64_STANDARD.encode(payload)
let b64_payload = BASE64_STANDARD.encode(payload);
write!(formatter, "{}", b64_payload)
}
}

Expand Down

0 comments on commit fe0d3af

Please sign in to comment.