Skip to content

Commit 8b50a4d

Browse files
authored
Merge pull request #1319 from wprzytula/adjust-to-msrv-1.80
Adjust to MSRV 1.80
2 parents 597d088 + 85b0d8b commit 8b50a4d

File tree

7 files changed

+14
-24
lines changed

7 files changed

+14
-24
lines changed

Cargo.lock.msrv

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scylla-cql/src/deserialize/result.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ mod tests {
237237

238238
use bytes::Bytes;
239239
use std::ops::Deref;
240+
use std::sync::LazyLock;
240241

241242
use crate::frame::response::result::{
242243
ColumnSpec, ColumnType, DeserializedMetadataAndRawRows, NativeType, ResultMetadata,
@@ -285,19 +286,15 @@ mod tests {
285286
//
286287
// I: for<'item> LendingIterator<Item<'item> = ColumnIterator<'item>>,
287288
//
288-
// The bug is said to be a lot of effort to fix, so in tests let's just use `lazy_static`
289+
// The bug is said to be a lot of effort to fix, so in tests let's just use `LazyLock`
289290
// to obtain 'static references.
290-
//
291-
// `std::sync::LazyLock` is stable since 1.80, so once we bump MSRV enough,
292-
// we will be able to replace `lazy_static` with `LazyLock`.
293291

294292
static SPECS: &[ColumnSpec<'static>] = &[
295293
spec("b1", ColumnType::Native(NativeType::Blob)),
296294
spec("b2", ColumnType::Native(NativeType::Blob)),
297295
];
298-
lazy_static::lazy_static! {
299-
static ref RAW_DATA: Bytes = serialize_cells([Some(CELL1), Some(CELL2), Some(CELL2), Some(CELL1)]);
300-
}
296+
static RAW_DATA: LazyLock<Bytes> =
297+
LazyLock::new(|| serialize_cells([Some(CELL1), Some(CELL2), Some(CELL2), Some(CELL1)]));
301298
let raw_data = RAW_DATA.deref();
302299
let specs = SPECS;
303300

@@ -339,9 +336,9 @@ mod tests {
339336
spec("b1", ColumnType::Native(NativeType::Blob)),
340337
spec("b2", ColumnType::Native(NativeType::Blob)),
341338
];
342-
lazy_static::lazy_static! {
343-
static ref RAW_DATA: Bytes = serialize_cells([Some(CELL1), Some(CELL2)]);
344-
}
339+
static RAW_DATA: LazyLock<Bytes> =
340+
LazyLock::new(|| serialize_cells([Some(CELL1), Some(CELL2)]));
341+
345342
let raw_data = RAW_DATA.deref();
346343
let specs = SPECS;
347344

scylla/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ url = { version = "2.3.1", optional = true }
7979
base64 = { version = "0.22.1", optional = true }
8080
rand_pcg = "0.9.0"
8181
socket2 = { version = "0.5.3", features = ["all"] }
82-
lazy_static = "1"
8382

8483
[dev-dependencies]
8584
num-bigint-03 = { package = "num-bigint", version = "0.3" }

scylla/src/client/session_builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use tracing::warn;
2828
mod sealed {
2929
// This is a sealed trait - its whole purpose is to be unnameable.
3030
// This means we need to disable the check.
31-
#[allow(unknown_lints)] // Rust 1.66 doesn't know this lint
3231
#[allow(unnameable_types)]
3332
pub trait Sealed {}
3433
}

scylla/src/network/tls.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ impl TlsProvider {
8383
};
8484

8585
cloud_config.make_tls_config_for_scylla_cloud_host(host_id, dc, address)
86-
// inspect_err() is stable since 1.76.
87-
// TODO: use inspect_err once we bump MSRV to at least 1.76.
88-
.map_err(|err| {
86+
.inspect_err(|err| {
8987
warn!(
9088
"TlsProvider for SNI connection to Scylla Cloud node {{ host_id={:?}, dc={:?} at {} }} could not be set up: {}\n Proceeding with attempting probably nonworking connection",
9189
host_id,

scylla/src/routing/locator/tablets.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bytes::Bytes;
22
use itertools::Itertools;
3-
use lazy_static::lazy_static;
43
use scylla_cql::deserialize::value::{DeserializeValue, ListlikeIterator};
54
use scylla_cql::deserialize::{DeserializationError, FrameSlice, TypeCheckError};
65
use scylla_cql::frame::response::result::{CollectionType, ColumnType, NativeType, TableSpec};
@@ -13,7 +12,7 @@ use crate::routing::{Shard, Token};
1312

1413
use std::collections::{HashMap, HashSet};
1514
use std::ops::Deref;
16-
use std::sync::Arc;
15+
use std::sync::{Arc, LazyLock};
1716

1817
#[derive(Error, Debug)]
1918
pub(crate) enum TabletParsingError {
@@ -42,19 +41,19 @@ pub(crate) struct RawTablet {
4241
type RawTabletPayload<'frame, 'metadata> =
4342
(i64, i64, ListlikeIterator<'frame, 'metadata, (Uuid, i32)>);
4443

45-
lazy_static! {
46-
static ref RAW_TABLETS_CQL_TYPE: ColumnType<'static> = ColumnType::Tuple(vec![
44+
static RAW_TABLETS_CQL_TYPE: LazyLock<ColumnType<'static>> = LazyLock::new(|| {
45+
ColumnType::Tuple(vec![
4746
ColumnType::Native(NativeType::BigInt),
4847
ColumnType::Native(NativeType::BigInt),
4948
ColumnType::Collection {
5049
frozen: false,
5150
typ: CollectionType::List(Box::new(ColumnType::Tuple(vec![
5251
ColumnType::Native(NativeType::Uuid),
5352
ColumnType::Native(NativeType::Int),
54-
])))
53+
]))),
5554
},
56-
]);
57-
}
55+
])
56+
});
5857

5958
const CUSTOM_PAYLOAD_TABLETS_V1_KEY: &str = "tablets-routing-v1";
6059

scylla/src/routing/partitioner.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ impl PartitionerHasher for PartitionerHasherAny {
7878
mod sealed {
7979
// This is a sealed trait - its whole purpose is to be unnameable.
8080
// This means we need to disable the check.
81-
#[allow(unknown_lints)] // Rust 1.70 doesn't know this lint
8281
#[allow(unnameable_types)]
8382
pub trait Sealed {}
8483
}

0 commit comments

Comments
 (0)