From e25419d3bab6da41452b5af0ec8671a540df38c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Bary=C5=82a?= Date: Mon, 21 Oct 2024 13:42:23 +0200 Subject: [PATCH] Cargo.toml: warn on unnameable types Such types should not appear anywhere - except for sealed traits. Previous commits removed all occurrences of such types, so now we can enable the lint. The one legit occurrence - a sealed trait - is marked with `#[allow]`. --- scylla-cql/Cargo.toml | 1 + scylla-macros/Cargo.toml | 1 + scylla/Cargo.toml | 1 + scylla/src/transport/session_builder.rs | 3 +++ 4 files changed, 6 insertions(+) diff --git a/scylla-cql/Cargo.toml b/scylla-cql/Cargo.toml index 089c9f5fa..537e307fa 100644 --- a/scylla-cql/Cargo.toml +++ b/scylla-cql/Cargo.toml @@ -55,4 +55,5 @@ full-serialization = [ ] [lints.rust] +unnameable_types = "warn" unreachable_pub = "warn" diff --git a/scylla-macros/Cargo.toml b/scylla-macros/Cargo.toml index eba770406..f91d92687 100644 --- a/scylla-macros/Cargo.toml +++ b/scylla-macros/Cargo.toml @@ -18,4 +18,5 @@ quote = "1.0" proc-macro2 = "1.0" [lints.rust] +unnameable_types = "warn" unreachable_pub = "warn" diff --git a/scylla/Cargo.toml b/scylla/Cargo.toml index 0a51427b0..01c7cf1cb 100644 --- a/scylla/Cargo.toml +++ b/scylla/Cargo.toml @@ -95,5 +95,6 @@ name = "benchmark" harness = false [lints.rust] +unnameable_types = "warn" unreachable_pub = "warn" unexpected_cfgs = { level = "warn", check-cfg = ['cfg(scylla_cloud_tests)'] } diff --git a/scylla/src/transport/session_builder.rs b/scylla/src/transport/session_builder.rs index c5373f7c2..b34869d2c 100644 --- a/scylla/src/transport/session_builder.rs +++ b/scylla/src/transport/session_builder.rs @@ -29,6 +29,9 @@ use openssl::ssl::SslContext; use tracing::warn; mod sealed { + // This is a sealed trait - its whole purpose is to be unnameable. + // This means we need to disable the check. + #[allow(unnameable_types)] pub trait Sealed {} } pub trait SessionBuilderKind: sealed::Sealed + Clone {}