Skip to content

Commit a939123

Browse files
committed
WIP: Replace allow with expect
1 parent 61950e1 commit a939123

File tree

37 files changed

+77
-76
lines changed

37 files changed

+77
-76
lines changed

examples/basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async fn main() -> Result<()> {
6161
}
6262

6363
// Or as custom structs that derive DeserializeRow
64-
#[allow(unused)]
64+
#[expect(unused)]
6565
#[derive(Debug, DeserializeRow)]
6666
struct RowData {
6767
a: i32,

scylla-cql/src/deserialize/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl RawRowLendingIterator {
175175
/// The column iterator must be consumed before the rows iterator can
176176
/// continue.
177177
#[inline]
178-
#[allow(clippy::should_implement_trait)] // https://github.com/rust-lang/rust-clippy/issues/5004
178+
#[expect(clippy::should_implement_trait)] // https://github.com/rust-lang/rust-clippy/issues/5004
179179
pub fn next(&mut self) -> Option<Result<ColumnIterator, DeserializationError>> {
180180
self.remaining = self.remaining.checked_sub(1)?;
181181

@@ -258,7 +258,7 @@ mod tests {
258258

259259
// Disable the lint, if there is more than one lifetime included.
260260
// Can be removed once https://github.com/rust-lang/rust-clippy/issues/12495 is fixed.
261-
#[allow(clippy::needless_lifetimes)]
261+
#[expect(clippy::needless_lifetimes)]
262262
impl<'frame, 'metadata> LendingIterator for RawRowIterator<'frame, 'metadata> {
263263
type Item<'borrow>
264264
= ColumnIterator<'borrow, 'borrow>

scylla-cql/src/deserialize/row_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,9 @@ fn metadata_does_not_bound_deserialized_rows() {
932932
#[derive(DeserializeRow)]
933933
#[scylla(crate=crate)]
934934
struct MyRow<'frame> {
935-
#[allow(dead_code)]
935+
#[expect(dead_code)]
936936
bytes: &'frame [u8],
937-
#[allow(dead_code)]
937+
#[expect(dead_code)]
938938
text: &'frame str,
939939
}
940940
let decoded_custom_struct_res = deserialize::<MyRow>(row_typ, &bytes);

scylla-cql/src/deserialize/value_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn test_custom_cassandra_type_parser() {
4242
dimensions: 5,
4343
},
4444
),
45-
( "636f6c756d6e:org.apache.cassandra.db.marshal.ListType(org.apache.cassandra.db.marshal.Int32Type)",
45+
( "636f6c756d6e:org.apache.cassandra.db.marshal.ListType(org.apache.cassandra.db.marshal.Int32Type)",
4646
ColumnType::Collection {
4747
frozen: false,
4848
typ: CollectionType::List(Box::new(ColumnType::Native(NativeType::Int))),
@@ -2781,9 +2781,9 @@ fn metadata_does_not_bound_deserialized_values() {
27812781
#[derive(DeserializeValue)]
27822782
#[scylla(crate=crate)]
27832783
struct Udt<'frame> {
2784-
#[allow(dead_code)]
2784+
#[expect(dead_code)]
27852785
bytes: &'frame [u8],
2786-
#[allow(dead_code)]
2786+
#[expect(dead_code)]
27872787
text: &'frame str,
27882788
}
27892789
let decoded_udt_res = deserialize::<Udt>(&udt_typ, &bytes);

scylla-cql/src/frame/request/batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl BatchStatement<'_> {
228228

229229
// Disable the lint, if there is more than one lifetime included.
230230
// Can be removed once https://github.com/rust-lang/rust-clippy/issues/12495 is fixed.
231-
#[allow(clippy::needless_lifetimes)]
231+
#[expect(clippy::needless_lifetimes)]
232232
impl<'s, 'b> From<&'s BatchStatement<'b>> for BatchStatement<'s> {
233233
fn from(value: &'s BatchStatement) -> Self {
234234
match value {

scylla-cql/src/frame/request/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl Request<'_> {
162162
Request::Query(q) => Some(q.parameters.consistency),
163163
Request::Execute(e) => Some(e.parameters.consistency),
164164
Request::Batch(b) => Some(b.consistency),
165-
#[allow(unreachable_patterns)] // until other opcodes are supported
165+
#[expect(unreachable_patterns)] // until other opcodes are supported
166166
_ => None,
167167
}
168168
}
@@ -173,7 +173,7 @@ impl Request<'_> {
173173
Request::Query(q) => Some(q.parameters.serial_consistency),
174174
Request::Execute(e) => Some(e.parameters.serial_consistency),
175175
Request::Batch(b) => Some(b.serial_consistency),
176-
#[allow(unreachable_patterns)] // until other opcodes are supported
176+
#[expect(unreachable_patterns)] // until other opcodes are supported
177177
_ => None,
178178
}
179179
}

scylla-cql/src/frame/response/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl ColumnType<'_> {
260260
// Scylla's set of types supported for empty values as it's smaller;
261261
// with Cassandra, some rejects will just have to be rejected on the db side.
262262
pub(crate) fn supports_special_empty_value(&self) -> bool {
263-
#[allow(clippy::match_like_matches_macro)]
263+
#[expect(clippy::match_like_matches_macro)]
264264
match self {
265265
ColumnType::Native(NativeType::Counter)
266266
| ColumnType::Native(NativeType::Duration)

scylla-cql/src/serialize/row_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ struct TestRowWithSkippedFields {
669669
a: String,
670670
b: i32,
671671
#[scylla(skip)]
672-
#[allow(dead_code)]
672+
#[expect(dead_code)]
673673
skipped: Vec<String>,
674674
c: Vec<i64>,
675675
}

scylla-cql/src/serialize/value_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ fn test_cql_value_udt_errors() {
522522
// Do not remove. It's not used in tests but we keep it here to check that
523523
// we properly ignore warnings about unused variables, unnecessary `mut`s
524524
// etc. that usually pop up when generating code for empty structs.
525-
#[allow(unused)]
525+
#[expect(unused)]
526526
#[derive(SerializeValue)]
527527
#[scylla(crate = crate)]
528528
struct TestUdtWithNoFields {}
@@ -1162,7 +1162,7 @@ fn test_udt_serialization_with_field_rename_and_enforce_order() {
11621162
assert_eq!(reference, udt);
11631163
}
11641164

1165-
#[allow(unused)]
1165+
#[expect(unused)]
11661166
#[derive(SerializeValue, Debug)]
11671167
#[scylla(crate = crate, flavor = "enforce_order", skip_name_checks)]
11681168
struct TestUdtWithSkippedNameChecks {
@@ -1329,7 +1329,7 @@ struct TestUdtWithSkippedFields {
13291329
a: String,
13301330
b: i32,
13311331
#[scylla(skip)]
1332-
#[allow(dead_code)]
1332+
#[expect(dead_code)]
13331333
skipped: Vec<String>,
13341334
c: Vec<i64>,
13351335
}

scylla-macros/src/deserialize/row.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl DeserializeAssumeOrderGenerator<'_> {
322322

323323
parse_quote! {
324324
fn deserialize(
325-
#[allow(unused_mut)]
325+
#[expect(unused_mut)]
326326
mut row: #macro_internal::ColumnIterator<#frame_lifetime, #metadata_lifetime>,
327327
) -> ::std::result::Result<Self, #macro_internal::DeserializationError> {
328328
::std::result::Result::Ok(Self {
@@ -576,7 +576,7 @@ impl DeserializeUnorderedGenerator<'_> {
576576

577577
parse_quote! {
578578
fn deserialize(
579-
#[allow(unused_mut)]
579+
#[expect(unused_mut)]
580580
mut row: #macro_internal::ColumnIterator<#frame_lifetime, #metadata_lifetime>,
581581
) -> ::std::result::Result<Self, #macro_internal::DeserializationError> {
582582

scylla-macros/src/deserialize/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ impl DeserializeAssumeOrderGenerator<'_> {
536536
let field_idents = fields.iter().map(|f| f.ident.as_ref().unwrap());
537537
let field_finalizers = fields.iter().map(|f| self.generate_finalize_field(f));
538538

539-
#[allow(unused_mut)]
539+
#[expect(unused_mut)]
540540
let mut iterator_type: syn::Type =
541541
parse_quote!(#macro_internal::UdtIterator<#frame_lifetime, #metadata_lifetime>);
542542

scylla-macros/src/serialize/row.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl Generator for ColumnSortingGenerator<'_> {
396396
#partial_struct
397397
#partial_serialize
398398

399-
#[allow(non_local_definitions)]
399+
#[expect(non_local_definitions)]
400400
#serialize_by_name
401401

402402
#crate_path::ser::row::ByName::<Self>::serialize(#crate_path::ser::row::ByName(self), ctx, writer)
@@ -447,7 +447,7 @@ impl Generator for ColumnOrderedGenerator<'_> {
447447
ctx: &#crate_path::RowSerializationContext,
448448
writer: &mut #crate_path::RowWriter<'_scylla_ser_row_writer_buffer>,
449449
) -> ::std::result::Result<(), #crate_path::SerializationError> {
450-
#[allow(non_local_definitions)]
450+
#[expect(non_local_definitions)]
451451
impl #impl_generics #crate_path::SerializeRowInOrder for #struct_name #ty_generics #where_clause {
452452
fn serialize_in_order(
453453
&self,

scylla-proxy/src/actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Condition {
121121
}
122122

123123
/// A convenience function for creating [Condition::Not] variant.
124-
#[allow(clippy::should_implement_trait)]
124+
#[expect(clippy::should_implement_trait)]
125125
pub fn not(c: Self) -> Self {
126126
Condition::Not(Box::new(c))
127127
}

scylla-proxy/src/proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ impl ProxyWorker {
12281228
.await;
12291229
}
12301230

1231-
#[allow(clippy::too_many_arguments)]
1231+
#[expect(clippy::too_many_arguments)]
12321232
async fn request_processor(
12331233
self,
12341234
mut requests_rx: mpsc::UnboundedReceiver<RequestFrame>,
@@ -1350,7 +1350,7 @@ impl ProxyWorker {
13501350
.await;
13511351
}
13521352

1353-
#[allow(clippy::too_many_arguments)]
1353+
#[expect(clippy::too_many_arguments)]
13541354
async fn response_processor(
13551355
self,
13561356
mut responses_rx: mpsc::UnboundedReceiver<ResponseFrame>,

scylla/src/client/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ impl Session {
854854
#[cfg(not(feature = "unstable-cloud"))]
855855
let cloud_known_nodes: Option<Vec<InternalKnownNode>> = None;
856856

857-
#[allow(clippy::unnecessary_literal_unwrap)]
857+
#[expect(clippy::unnecessary_literal_unwrap)]
858858
let known_nodes = cloud_known_nodes
859859
.unwrap_or_else(|| known_nodes.into_iter().map(|node| node.into()).collect());
860860

@@ -865,7 +865,7 @@ impl Session {
865865

866866
let (tablet_sender, tablet_receiver) = tokio::sync::mpsc::channel(TABLET_CHANNEL_SIZE);
867867

868-
#[allow(unused_labels)] // Triggers when `cloud` feature is disabled.
868+
#[expect(unused_labels)] // Triggers when `cloud` feature is disabled.
869869
let address_translator = 'translator: {
870870
#[cfg(feature = "unstable-cloud")]
871871
if let Some(translator) = config.cloud_config.clone() {
@@ -902,9 +902,9 @@ impl Session {
902902
if let Some(tls_context) = config.tls_context {
903903
// To silence warnings when TlsContext is an empty enum (tls features are disabled).
904904
// In such case, TlsProvider is uninhabited.
905-
#[allow(unused_variables)]
905+
#[expect(unused_variables)]
906906
let provider = TlsProvider::new_with_global_context(tls_context);
907-
#[allow(unreachable_code)]
907+
#[expect(unreachable_code)]
908908
break 'provider Some(provider);
909909
}
910910
None

scylla/src/client/session_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ 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(unnameable_types)]
31+
#[expect(unnameable_types)]
3232
pub trait Sealed {}
3333
}
3434
pub trait SessionBuilderKind: sealed::Sealed + Clone {}

scylla/src/cloud/config.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ pub enum CloudTlsProvider {
168168
#[derive(Debug)]
169169
pub(crate) struct AuthInfo {
170170
tls: TlsInfo,
171-
#[allow(unused)]
171+
#[expect(unused)]
172172
username: Option<String>,
173-
#[allow(unused)]
173+
#[expect(unused)]
174174
password: Option<String>,
175175
}
176176

@@ -266,12 +266,12 @@ impl AuthInfo {
266266
&self.tls
267267
}
268268

269-
#[allow(unused)]
269+
#[expect(unused)]
270270
pub(crate) fn get_username(&self) -> Option<&str> {
271271
self.username.as_deref()
272272
}
273273

274-
#[allow(unused)]
274+
#[expect(unused)]
275275
pub(crate) fn get_password(&self) -> Option<&str> {
276276
self.password.as_deref()
277277
}
@@ -282,11 +282,11 @@ impl AuthInfo {
282282
pub(crate) struct Datacenter {
283283
ca_cert: TlsCert,
284284
server: String,
285-
#[allow(unused)]
285+
#[expect(unused)]
286286
tls_server_name: Option<String>,
287287
node_domain: String,
288288
insecure_skip_tls_verify: bool,
289-
#[allow(unused)]
289+
#[expect(unused)]
290290
proxy_url: Option<String>,
291291
}
292292

@@ -295,7 +295,7 @@ impl Datacenter {
295295
&self.server
296296
}
297297

298-
#[allow(unused)]
298+
#[expect(unused)]
299299
pub(crate) fn get_tls_server_name(&self) -> Option<&str> {
300300
self.tls_server_name.as_deref()
301301
}
@@ -308,7 +308,7 @@ impl Datacenter {
308308
self.insecure_skip_tls_verify
309309
}
310310

311-
#[allow(unused)]
311+
#[expect(unused)]
312312
pub(crate) fn get_proxy_url(&self) -> Option<&str> {
313313
self.proxy_url.as_deref()
314314
}
@@ -326,7 +326,7 @@ impl TlsCert {
326326
#[cfg(feature = "openssl-010")]
327327
fn openssl_ca(&self) -> Option<&openssl::x509::X509> {
328328
// To silence the compiler warnings when enum consists of only one variant.
329-
#[allow(irrefutable_let_patterns)]
329+
#[expect(irrefutable_let_patterns)]
330330
if let TlsCert::OpenSsl010(ca) = self {
331331
Some(ca)
332332
} else {
@@ -337,7 +337,7 @@ impl TlsCert {
337337
#[cfg(feature = "rustls-023")]
338338
fn rustls_ca(&self) -> Option<&rustls::pki_types::CertificateDer<'static>> {
339339
// To silence the compiler warnings when enum consists of only one variant.
340-
#[allow(irrefutable_let_patterns)]
340+
#[expect(irrefutable_let_patterns)]
341341
if let TlsCert::Rustls023(ca) = self {
342342
Some(ca)
343343
} else {
@@ -371,7 +371,7 @@ mod deserialize {
371371
const NODE_DOMAIN_MAX_LENGTH: usize = 255 - 32 - 4 - 1;
372372

373373
#[derive(Deserialize)]
374-
#[allow(non_snake_case)]
374+
#[expect(non_snake_case)]
375375
struct RawCloudConfig {
376376
// Kind is a string value representing the REST resource this object represents.
377377
// Servers may infer this from the endpoint the client submits requests to.
@@ -402,7 +402,7 @@ mod deserialize {
402402
parameters: Option<Parameters>,
403403
}
404404

405-
#[allow(non_snake_case)]
405+
#[expect(non_snake_case)]
406406
#[derive(Deserialize)]
407407
struct AuthInfo {
408408
// ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificatePath.
@@ -429,7 +429,7 @@ mod deserialize {
429429
password: Option<String>,
430430
}
431431

432-
#[allow(non_snake_case)]
432+
#[expect(non_snake_case)]
433433
#[derive(Deserialize)]
434434
struct Datacenter {
435435
// CertificateAuthorityPath is the path to a cert file for the certificate authority.
@@ -466,7 +466,7 @@ mod deserialize {
466466
proxyUrl: Option<String>,
467467
}
468468

469-
#[allow(non_snake_case)]
469+
#[expect(non_snake_case)]
470470
#[derive(Deserialize)]
471471
struct Context {
472472
// DatacenterName is the name of the datacenter for this context.
@@ -476,7 +476,7 @@ mod deserialize {
476476
authInfoName: String,
477477
}
478478

479-
#[allow(non_snake_case)]
479+
#[expect(non_snake_case)]
480480
#[derive(Deserialize, Debug)]
481481
struct Parameters {
482482
// DefaultConsistency is the default consistency level used for user queries.

scylla/src/cluster/metadata.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl std::str::FromStr for ColumnKind {
359359

360360
#[derive(Clone, Debug, PartialEq, Eq)]
361361
#[non_exhaustive]
362-
#[allow(clippy::enum_variant_names)]
362+
#[expect(clippy::enum_variant_names)]
363363
pub enum Strategy {
364364
SimpleStrategy {
365365
replication_factor: usize,
@@ -421,7 +421,7 @@ impl Metadata {
421421

422422
impl MetadataReader {
423423
/// Creates new MetadataReader, which connects to initially_known_peers in the background
424-
#[allow(clippy::too_many_arguments)]
424+
#[expect(clippy::too_many_arguments)]
425425
pub(crate) async fn new(
426426
initial_known_nodes: Vec<InternalKnownNode>,
427427
control_connection_repair_requester: broadcast::Sender<()>,
@@ -1664,7 +1664,7 @@ impl ControlConnection {
16641664
'tables_loop: for ((keyspace_name, table_name), table_result) in tables_schema {
16651665
let keyspace_and_table_name = (keyspace_name, table_name);
16661666

1667-
#[allow(clippy::type_complexity)]
1667+
#[expect(clippy::type_complexity)]
16681668
let (columns, partition_key_columns, clustering_key_columns): (
16691669
HashMap<String, Column>,
16701670
Vec<(i32, String)>,

0 commit comments

Comments
 (0)