Fix some warnings/issues uncovered by the new cfg checking (#12310)

Rust recently got the ability to check for typos or errors in `cfg`
attributes: https://blog.rust-lang.org/2024/05/06/check-cfg.html
This PR fixes the new warnings.

- gpui can be run with `RUSTFLAGS="--cfg gles"`, make this explicit in
`[workspace.lints.rust]`
- `cfg!(any(test, sqlite))` was just a bug, it should be
`feature(sqlite)`
- the `languages` crate had a `#[cfg(any(test, feature =
"test-support"))]` function without ever declaring the `test-support`
feature
- the `MarkdownTag` enum had a `cfg_attr` for serde without actually
having serde support


Now the only warnings when building are unused fields
`InlayHover.excerpt`, `SavedConversationMetadata.path` ,
`UserTestPlan.allow_client_reconnection` and `SyntaxMapCapture.depth`.

Release Notes:

- N/A
This commit is contained in:
Jakob Hellermann 2024-05-26 12:50:20 +02:00 committed by GitHub
parent 78aaa29d5b
commit a1e5b122e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 2 deletions

View File

@ -492,5 +492,10 @@ non_canonical_partial_ord_impl = "allow"
reversed_empty_ranges = "allow" reversed_empty_ranges = "allow"
type_complexity = "allow" type_complexity = "allow"
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(gles)' # used in gpui
] }
[workspace.metadata.cargo-machete] [workspace.metadata.cargo-machete]
ignored = ["bindgen", "cbindgen", "prost_build", "serde"] ignored = ["bindgen", "cbindgen", "prost_build", "serde"]

View File

@ -713,7 +713,7 @@ impl Database {
.find_also_related(user::Entity) .find_also_related(user::Entity)
.filter(channel_member::Column::ChannelId.eq(channel.root_id())); .filter(channel_member::Column::ChannelId.eq(channel.root_id()));
if cfg!(any(test, sqlite)) && self.pool.get_database_backend() == DbBackend::Sqlite { if cfg!(any(test, feature = "sqlite")) && self.pool.get_database_backend() == DbBackend::Sqlite {
query = query.filter(Expr::cust_with_values( query = query.filter(Expr::cust_with_values(
"UPPER(github_login) LIKE ?", "UPPER(github_login) LIKE ?",
[Self::fuzzy_like_string(&filter.to_uppercase())], [Self::fuzzy_like_string(&filter.to_uppercase())],

View File

@ -8,6 +8,9 @@ license = "GPL-3.0-or-later"
[lints] [lints]
workspace = true workspace = true
[features]
test-support = []
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
async-compression.workspace = true async-compression.workspace = true

View File

@ -144,7 +144,6 @@ pub enum MarkdownTag {
/// A footnote definition. The value contained is the footnote's label by which it can /// A footnote definition. The value contained is the footnote's label by which it can
/// be referred to. /// be referred to.
#[cfg_attr(feature = "serde", serde(borrow))]
FootnoteDefinition(SharedString), FootnoteDefinition(SharedString),
/// A table. Contains a vector describing the text-alignment for each of its columns. /// A table. Contains a vector describing the text-alignment for each of its columns.