Skip to content

Commit

Permalink
Cargo.toml: warn on unnameable types
Browse files Browse the repository at this point in the history
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]`.
  • Loading branch information
Lorak-mmk committed Oct 21, 2024
1 parent e499f85 commit a56b55b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions scylla-cql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ full-serialization = [
]

[lints.rust]
unnameable_types = "warn"
unreachable_pub = "warn"
1 change: 1 addition & 0 deletions scylla-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ quote = "1.0"
proc-macro2 = "1.0"

[lints.rust]
unnameable_types = "warn"
unreachable_pub = "warn"
1 change: 1 addition & 0 deletions scylla/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'] }
4 changes: 4 additions & 0 deletions scylla/src/transport/session_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ 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(unknown_lints)] // Rust 1.66 doesn't know this lint
#[allow(unnameable_types)]
pub trait Sealed {}
}
pub trait SessionBuilderKind: sealed::Sealed + Clone {}
Expand Down

0 comments on commit a56b55b

Please sign in to comment.