Skip to content

Commit 7721a50

Browse files
authored
Merge pull request #2049 from mintlayer/update_rust_edition
Update Rust edition to 2024
2 parents a9cbfce + 95f759a commit 7721a50

79 files changed

Lines changed: 722 additions & 578 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 50 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository = "https://github.com/mintlayer/mintlayer-core"
66
readme = "README.md"
77
license = "MIT"
88
version = "1.3.0"
9-
edition = "2021"
9+
edition = "2024"
1010

1111
[workspace]
1212
members = [
@@ -126,7 +126,7 @@ storage = { path = "storage" }
126126
utxo = { path = "utxo" }
127127

128128
[workspace.package]
129-
edition = "2021"
129+
edition = "2024"
130130
rust-version = "1.88"
131131
version = "1.3.0"
132132
license = "MIT"
@@ -156,7 +156,7 @@ console-subscriber = "0.5"
156156
criterion = "0.5"
157157
crossterm = "0.28"
158158
csv = "1.3"
159-
ctor = "0.2"
159+
ctor = "0.10"
160160
derive_more = { version = "1.0", features = ["full"] }
161161
directories = "5.0"
162162
humantime = "2.1"

api-server/api-server-common/src/storage/impls/in_memory/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,10 +1038,10 @@ impl ApiServerInMemoryStorage {
10381038

10391039
// Handle a degenerate case when the block is stored several times using different heights
10401040
// (to be consistent with the postgres implementation).
1041-
if let Some(previously_stored_height) = previously_stored_height {
1042-
if previously_stored_height != block_height {
1043-
self.main_chain_blocks_table.remove(&previously_stored_height);
1044-
}
1041+
if let Some(previously_stored_height) = previously_stored_height
1042+
&& previously_stored_height != block_height
1043+
{
1044+
self.main_chain_blocks_table.remove(&previously_stored_height);
10451045
}
10461046

10471047
Ok(())

api-server/scanner-daemon/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ utils = { path = "../../utils" }
1717
utils-networking = { path = "../../utils/networking" }
1818

1919
clap = { workspace = true, features = ["derive"] }
20+
ctor.workspace = true
2021
thiserror.workspace = true
2122
tokio = { workspace = true, features = ["full"] }
2223

api-server/scanner-daemon/src/main.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,10 @@ pub enum ApiServerScannerError {
140140
PostgresConnectionError(ApiServerStorageError),
141141
}
142142

143+
utils::enable_rust_backtrace!();
144+
143145
#[tokio::main]
144146
async fn main() -> Result<(), ApiServerScannerError> {
145-
utils::rust_backtrace::enable();
146-
147-
if std::env::var("RUST_LOG").is_err() {
148-
std::env::set_var("RUST_LOG", "info");
149-
}
150-
151147
let args = ApiServerScannerArgs::parse();
152148

153149
logging::init_logging();

api-server/storage-test-suite/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ serialization = { path = "../../serialization" }
1919

2020
async-trait.workspace = true
2121
chrono.workspace = true
22+
ctor.workspace = true
2223
futures = { workspace = true, default-features = false }
2324
libtest-mimic.workspace = true
2425
proptest.workspace = true

api-server/storage-test-suite/tests/in_memory.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ use api_server_common::storage::{
2020
storage_api::ApiServerStorage,
2121
};
2222
use common::chain::{config::create_unit_test_config, ChainConfig};
23-
use utils::rust_backtrace;
2423

2524
#[must_use]
2625
#[allow(clippy::unused_async)]
2726
async fn make_in_memory_storage(chain_config: Arc<ChainConfig>) -> impl ApiServerStorage {
2827
TransactionalApiServerInMemoryStorage::new(&chain_config)
2928
}
3029

31-
fn main() {
32-
rust_backtrace::enable();
30+
utils::enable_rust_backtrace!();
3331

32+
fn main() {
3433
let storage_maker = || make_in_memory_storage(Arc::new(create_unit_test_config()));
3534
let result = api_server_backend_test_suite::run(storage_maker);
3635

api-server/storage-test-suite/tests/postgres.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use api_server_common::storage::{
2323
};
2424
use common::chain::{config::create_unit_test_config, ChainConfig};
2525
use containers::with_container::ApiServerStorageWithContainer;
26-
use utils::rust_backtrace;
2726

2827
#[must_use]
2928
async fn make_postgres_storage(chain_config: Arc<ChainConfig>) -> impl ApiServerStorage {
@@ -56,9 +55,9 @@ async fn make_postgres_storage(chain_config: Arc<ChainConfig>) -> impl ApiServer
5655
ApiServerStorageWithContainer::new(storage, podman)
5756
}
5857

59-
fn main() {
60-
rust_backtrace::enable();
58+
utils::enable_rust_backtrace!();
6159

60+
fn main() {
6261
// Only run the test if the env var is defined
6362
if std::env::var("ML_CONTAINERIZED_TESTS").is_err() {
6463
eprintln!("Warning: Skipping Postgres containerized tests");

api-server/web-server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mempool = { path = "../../mempool" }
2020

2121
axum.workspace = true
2222
async-trait.workspace = true
23+
ctor.workspace = true
2324
clap = { workspace = true, features = ["derive"] }
2425
hex.workspace = true
2526
serde = { workspace = true, features = ["derive"] }

api-server/web-server/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ use utils::{cookie::COOKIE_FILENAME, default_data_dir::default_data_dir_for_chai
3636

3737
use crate::error::ApiServerWebServerInitError;
3838

39+
utils::enable_rust_backtrace!();
40+
3941
#[tokio::main]
4042
async fn main() -> Result<(), ApiServerWebServerInitError> {
41-
if std::env::var("RUST_LOG").is_err() {
42-
std::env::set_var("RUST_LOG", "info");
43-
}
44-
4543
logging::init_logging();
4644

4745
let args = ApiServerWebServerConfig::parse();

0 commit comments

Comments
 (0)