Skip to content

Commit 0a51074

Browse files
author
Lucas Kent
committed
Update to edition 2024
1 parent 3f0ffea commit 0a51074

File tree

35 files changed

+460
-491
lines changed

35 files changed

+460
-491
lines changed

custom-transforms-example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "custom-transforms-example"
33
version = "0.0.1"
44
authors = ["Ben <ben@instaclustr.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77

88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

custom-transforms-example/src/valkey_get_rewrite.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ impl Transform for ValkeyGetRewrite {
6969
chain_state: &'shorter mut ChainState<'longer>,
7070
) -> Result<Messages> {
7171
for message in chain_state.requests.iter_mut() {
72-
if let Some(frame) = message.frame() {
73-
if is_get(frame) {
74-
self.get_requests.insert(message.id());
75-
}
72+
if let Some(frame) = message.frame()
73+
&& is_get(frame)
74+
{
75+
self.get_requests.insert(message.id());
7676
}
7777
}
7878
let mut responses = chain_state.call_next_transform().await?;
@@ -82,11 +82,10 @@ impl Transform for ValkeyGetRewrite {
8282
.request_id()
8383
.map(|id| self.get_requests.remove(&id))
8484
.unwrap_or(false)
85+
&& let Some(frame) = response.frame()
8586
{
86-
if let Some(frame) = response.frame() {
87-
rewrite_get(frame, &self.result);
88-
response.invalidate_cache();
89-
}
87+
rewrite_get(frame, &self.result);
88+
response.invalidate_cache();
9089
}
9190
}
9291

ec2-cargo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ec2-cargo"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
license = "Apache-2.0"
66
description = "A tool for running cargo commands in an EC2 instance"
77

ec2-cargo/src/main.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ pub struct Args {
2828

2929
#[tokio::main]
3030
async fn main() {
31-
// Needed to disable anyhow stacktraces by default
32-
if std::env::var("RUST_LIB_BACKTRACE").is_err() {
33-
std::env::set_var("RUST_LIB_BACKTRACE", "0");
34-
}
35-
3631
let (non_blocking, _guard) = tracing_appender::non_blocking(std::io::stdout());
3732
tracing_subscriber::fmt()
3833
.with_env_filter(EnvFilter::from_default_env())

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
use_field_init_shorthand = true
2-
edition = "2021"
2+
edition = "2024"
33
style_edition = "2024"

shotover-proxy/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "shotover-proxy"
33
version = "0.7.2"
44
authors = ["Ben <ben@instaclustr.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77

88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

shotover-proxy/benches/windsock/cloud/aws.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,12 @@ impl RunningShotover {
410410
];
411411

412412
while let Some(event) = self.event_rx.recv().await {
413-
if let Level::Warn | Level::Error = event.level {
414-
if !ignore
413+
if let Level::Warn | Level::Error = event.level
414+
&& !ignore
415415
.iter()
416416
.any(|ignore| event.fields.message.contains(ignore))
417-
{
418-
panic!("Received error/warn event from shotover:\n {event}")
419-
}
417+
{
418+
panic!("Received error/warn event from shotover:\n {event}")
420419
}
421420
}
422421
}

shotover-proxy/benches/windsock/cloud/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ impl Cloud for AwsCloud {
120120
)
121121
}
122122
}
123-
if let Some(instance) = &resources.bencher {
124-
if Arc::strong_count(instance) != 1 {
125-
panic!(
126-
"A reference to a bencher instance has been held past the end of the benchmark. Ensure the benchmark destroys all instance references before ending."
127-
)
128-
}
123+
if let Some(instance) = &resources.bencher
124+
&& Arc::strong_count(instance) != 1
125+
{
126+
panic!(
127+
"A reference to a bencher instance has been held past the end of the benchmark. Ensure the benchmark destroys all instance references before ending."
128+
)
129129
}
130130

131131
// TODO: spin up background tokio task to delete unneeded EC2 instances once we add the functionality to aws_throwaway

shotover-proxy/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
use shotover::runner::Shotover;
22

33
fn main() {
4+
// Disable anyhow from taking backtraces, which makes for very verbose logs and is possibly a performance issue.
5+
if std::env::var("RUST_LIB_BACKTRACE").is_err() {
6+
// Safety: Safe because this is the first thing in main, we know that we havent launched any other threads which may access set_var.
7+
// TODO: Avoid usage of unsafe:
8+
// Maybe this https://github.com/dtolnay/anyhow/issues/403 ?
9+
// Or this https://github.com/rust-lang/rust/issues/93346 ?
10+
// Or maybe fork anyhow?
11+
unsafe { std::env::set_var("RUST_LIB_BACKTRACE", "0") };
12+
}
13+
414
Shotover::new().run_block();
515
}

shotover-proxy/tests/cassandra_int_tests/cluster/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ pub async fn run_topology_task(ca_path: Option<&str>, port: Option<u32>) -> Vec<
5757
.await
5858
.unwrap()
5959
.unwrap();
60-
let nodes = nodes_rx.borrow().clone();
61-
nodes
60+
61+
nodes_rx.borrow().clone()
6262
}
6363

6464
fn create_handshake() -> Vec<Message> {

0 commit comments

Comments
 (0)