Skip to content

Commit 7a592ed

Browse files
committed
clippy --fix
1 parent e730e38 commit 7a592ed

3 files changed

Lines changed: 33 additions & 33 deletions

File tree

trino-lb/src/routing/trino_routing_group_header.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ impl RouterImplementationTrait for TrinoRoutingGroupHeaderRouter {
3232
)]
3333
async fn route(&self, query: &str, headers: &http::HeaderMap) -> Option<String> {
3434
let target_group = headers.get(&self.config.header_name);
35-
if let Some(target_group) = target_group {
36-
if let Ok(target_group) = target_group.to_str() {
37-
if self.valid_target_groups.contains(target_group) {
38-
return Some(target_group.to_string());
39-
} else {
40-
// TODO: Maybe let the routers return client errors to the clients in case of user errors.
41-
warn!(
42-
target_group,
43-
"The client requested a target group that does not exist, skipped routing"
44-
);
45-
}
35+
if let Some(target_group) = target_group
36+
&& let Ok(target_group) = target_group.to_str()
37+
{
38+
if self.valid_target_groups.contains(target_group) {
39+
return Some(target_group.to_string());
40+
} else {
41+
// TODO: Maybe let the routers return client errors to the clients in case of user errors.
42+
warn!(
43+
target_group,
44+
"The client requested a target group that does not exist, skipped routing"
45+
);
4646
}
4747
}
4848

trino-lb/src/scaling/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,15 @@ impl Scaler {
402402
// We don't want to shut down the last remaining cluster obviously
403403
// The only exception is the case no queries were running at all, in that case we shut down
404404
// the unneeded cluster.
405-
if shut_down_candidates.len() > 1 || current_running_queries == 0 {
406-
if let Some((_, to_shut_down)) = shut_down_candidates.first() {
407-
target_states.insert(
408-
to_shut_down.name.to_owned(),
409-
ClusterState::Draining {
410-
last_time_seen_with_queries: SystemTime::now(),
411-
},
412-
);
413-
}
405+
if (shut_down_candidates.len() > 1 || current_running_queries == 0)
406+
&& let Some((_, to_shut_down)) = shut_down_candidates.first()
407+
{
408+
target_states.insert(
409+
to_shut_down.name.to_owned(),
410+
ClusterState::Draining {
411+
last_time_seen_with_queries: SystemTime::now(),
412+
},
413+
);
414414
}
415415
}
416416
}

trino-lb/src/tracing.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ pub fn init(
5353
let console_output_layer = tracing_subscriber::fmt::layer().with_filter(env_filter_layer);
5454
let mut layers = vec![console_output_layer.boxed()];
5555

56-
if let Some(tracing_config) = tracing_config {
57-
if tracing_config.enabled {
58-
let env_filter_layer = EnvFilter::builder()
59-
.with_default_directive(LevelFilter::DEBUG.into())
60-
.from_env_lossy();
61-
layers.push(
62-
tracing_opentelemetry::layer()
63-
.with_error_records_to_exceptions(true)
64-
.with_tracer(otel_tracer(tracing_config)?)
65-
.with_filter(env_filter_layer)
66-
.boxed(),
67-
);
68-
}
56+
if let Some(tracing_config) = tracing_config
57+
&& tracing_config.enabled
58+
{
59+
let env_filter_layer = EnvFilter::builder()
60+
.with_default_directive(LevelFilter::DEBUG.into())
61+
.from_env_lossy();
62+
layers.push(
63+
tracing_opentelemetry::layer()
64+
.with_error_records_to_exceptions(true)
65+
.with_tracer(otel_tracer(tracing_config)?)
66+
.with_filter(env_filter_layer)
67+
.boxed(),
68+
);
6969
}
7070

7171
let registry = prometheus::Registry::new();

0 commit comments

Comments
 (0)