Skip to content

Commit d3d3b01

Browse files
committed
chore: cleanup remaining feature gates
1 parent 6008c92 commit d3d3b01

File tree

25 files changed

+70
-76
lines changed

25 files changed

+70
-76
lines changed

Cargo.lock

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

crates/pglt_cli/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ tikv-jemallocator = "0.6.0"
5555
[lib]
5656
doctest = false
5757

58-
[features]
59-
6058
[[bin]]
6159
name = "pglt"
6260
path = "src/main.rs"

crates/pglt_commands/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ sqlx.workspace = true
1919

2020
[lib]
2121
doctest = false
22-
23-
[features]

crates/pglt_completions/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ pglt_test_utils.workspace = true
3333

3434
[lib]
3535
doctest = false
36-
37-
[features]

crates/pglt_console/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ unicode-width = { workspace = true }
2525
trybuild = "1.0.99"
2626

2727
[features]
28-
serde_markup = ["serde", "schemars"]
28+
schema = ["dep:schemars", "pglt_text_size/schema"]
29+
serde = ["dep:serde"]
2930

3031
[lib]
3132
doctest = false

crates/pglt_console/src/markup.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ use crate::fmt::{Display, Formatter, MarkupElements, Write};
1111

1212
/// Enumeration of all the supported markup elements
1313
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
14-
#[cfg_attr(
15-
feature = "serde",
16-
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
17-
)]
14+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1816
pub enum MarkupElement<'fmt> {
1917
Emphasis,
2018
Dim,
@@ -122,10 +120,8 @@ pub struct MarkupNode<'fmt> {
122120
}
123121

124122
#[derive(Clone, PartialEq, Eq, Hash)]
125-
#[cfg_attr(
126-
feature = "serde",
127-
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
128-
)]
123+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
124+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
129125
pub struct MarkupNodeBuf {
130126
pub elements: Vec<MarkupElement<'static>>,
131127
pub content: String,
@@ -181,10 +177,8 @@ impl Markup<'_> {
181177
}
182178

183179
#[derive(Clone, Default, PartialEq, Eq, Hash)]
184-
#[cfg_attr(
185-
feature = "serde",
186-
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
187-
)]
180+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
181+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
188182
pub struct MarkupBuf(pub Vec<MarkupNodeBuf>);
189183

190184
impl MarkupBuf {

crates/pglt_diagnostics/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ version = "0.0.0"
1515
backtrace = "0.3.74"
1616
bpaf = { workspace = true }
1717
enumflags2 = { workspace = true }
18-
pglt_console = { workspace = true, features = ["serde_markup"] }
18+
pglt_console = { workspace = true, features = ["serde"] }
1919
pglt_diagnostics_categories = { workspace = true, features = ["serde"] }
2020
pglt_diagnostics_macros = { workspace = true }
21-
pglt_text_edit = { workspace = true }
21+
pglt_text_edit = { workspace = true, features = ["serde"] }
2222
pglt_text_size.workspace = true
2323
schemars = { workspace = true, optional = true }
2424
serde = { workspace = true, features = ["derive"] }
@@ -27,7 +27,7 @@ termcolor = { workspace = true }
2727
unicode-width = { workspace = true }
2828

2929
[features]
30-
schema = ["schemars", "pglt_text_edit/schemars", "pglt_diagnostics_categories/schemars"]
30+
schema = ["dep:schemars", "pglt_text_edit/schema", "pglt_diagnostics_categories/schema", "pglt_console/schema"]
3131

3232
[dev-dependencies]
3333

crates/pglt_diagnostics_categories/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ version = "0.0.0"
1515
schemars = { workspace = true, optional = true }
1616
serde = { workspace = true, optional = true }
1717

18+
[features]
19+
schema = ["dep:schemars"]
20+
serde = ["dep:serde"]
21+
1822
[build-dependencies]
1923
quote = "1.0.14"

crates/pglt_diagnostics_categories/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn main() -> io::Result<()> {
6464
}
6565
}
6666

67-
#[cfg(feature = "schemars")]
67+
#[cfg(feature = "schema")]
6868
impl schemars::JsonSchema for &'static Category {
6969
fn schema_name() -> String {
7070
String::from("Category")

crates/pglt_diagnostics_macros/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ quote = { workspace = true }
2121
syn = { workspace = true }
2222

2323
[dev-dependencies]
24-
25-
[features]

crates/pglt_flags/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ version = "0.0.0"
1515
pglt_console = { workspace = true }
1616

1717
[dev-dependencies]
18-
19-
[features]

crates/pglt_fs/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ pglt_diagnostics = { workspace = true }
2020
rayon = { workspace = true }
2121
rustc-hash = { workspace = true }
2222
schemars = { workspace = true, optional = true }
23-
serde = { workspace = true }
23+
serde = { workspace = true, optional = true }
2424
smallvec = { workspace = true }
2525
tracing = { workspace = true }
2626

2727
[features]
28-
serde = ["schemars", "pglt_diagnostics/schema"]
29-
30-
[dev-dependencies]
28+
schema = ["dep:schemars", "pglt_diagnostics/schema"]
29+
serde = ["dep:serde"]
3130

3231
[lib]
3332
doctest = false

crates/pglt_fs/src/path.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ use crate::ConfigName;
1717
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Ord, PartialOrd, Hash)]
1818
#[repr(u8)]
1919
#[bitflags]
20-
#[cfg_attr(
21-
feature = "serde",
22-
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
23-
)]
20+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
21+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2422
// NOTE: The order of the variants is important, the one on the top has the highest priority
2523
pub enum FileKind {
2624
/// A configuration file has the highest priority. It's usually `pglt.toml`
@@ -85,10 +83,8 @@ impl From<FileKind> for FileKinds {
8583
}
8684

8785
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
88-
#[cfg_attr(
89-
feature = "serde",
90-
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
91-
)]
86+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
87+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
9288
pub struct PgLTPath {
9389
path: PathBuf,
9490
/// Determines the kind of the file inside PgLT. Some files are considered as configuration files, others as manifest files, and others as files to handle
@@ -201,7 +197,7 @@ impl PgLTPath {
201197
}
202198
}
203199

204-
#[cfg(feature = "serde")]
200+
#[cfg(feature = "schema")]
205201
impl schemars::JsonSchema for FileKinds {
206202
fn schema_name() -> String {
207203
String::from("FileKind")

crates/pglt_lsp/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,3 @@ tower = { version = "0.4.13", features = ["timeout"] }
4141

4242
[lib]
4343
doctest = false
44-
45-
[features]

crates/pglt_lsp_converters/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ tower-lsp = { version = "0.20.0" }
2121

2222
[lib]
2323
doctest = false
24-
25-
[features]

crates/pglt_markup/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ quote = "1.0.14"
2020

2121
[lib]
2222
proc-macro = true
23-
24-
[features]

crates/pglt_text_edit/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ version = "0.0.0"
1212

1313

1414
[dependencies]
15-
pglt_text_size = { workspace = true, features = ["serde"] }
15+
pglt_text_size = { workspace = true }
1616
schemars = { workspace = true, optional = true }
17-
serde = { workspace = true, features = ["derive"] }
17+
serde = { workspace = true, features = ["derive"], optional = true }
1818
similar = { workspace = true, features = ["unicode"] }
1919

2020
[features]
21-
schemars = ["dep:schemars"]
21+
schema = ["dep:schemars", "pglt_text_size/schema"]
22+
serde = ["dep:serde", "pglt_text_size/serde"]
2223

2324
[dev-dependencies]
2425

crates/pglt_text_edit/src/lib.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,40 @@
1111
use std::{cmp::Ordering, num::NonZeroU32};
1212

1313
use pglt_text_size::{TextRange, TextSize};
14-
use serde::{Deserialize, Serialize};
1514
pub use similar::ChangeTag;
1615
use similar::{TextDiff, utils::TextDiffRemapper};
1716

18-
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
19-
#[serde(rename_all = "snake_case")]
17+
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash)]
18+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
19+
#[cfg_attr(
20+
feature = "serde",
21+
derive(serde::Serialize, serde::Deserialize),
22+
serde(rename_all = "camelCase")
23+
)]
2024
pub struct TextEdit {
2125
dictionary: String,
2226
ops: Vec<CompressedOp>,
2327
}
2428

25-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
26-
#[serde(rename_all = "snake_case")]
29+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
30+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
31+
#[cfg_attr(
32+
feature = "serde",
33+
derive(serde::Serialize, serde::Deserialize),
34+
serde(rename_all = "camelCase")
35+
)]
2736
pub enum CompressedOp {
2837
DiffOp(DiffOp),
2938
EqualLines { line_count: NonZeroU32 },
3039
}
3140

32-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
33-
#[serde(rename_all = "snake_case")]
41+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
42+
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
43+
#[cfg_attr(
44+
feature = "serde",
45+
derive(serde::Serialize, serde::Deserialize),
46+
serde(rename_all = "camelCase")
47+
)]
3448
pub enum DiffOp {
3549
Equal { range: TextRange },
3650
Insert { range: TextRange },

crates/pglt_text_size/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ schemars = { workspace = true, optional = true }
1515
serde = { workspace = true, optional = true }
1616

1717
[features]
18-
schema = ["dep:schemars", "serde"]
18+
schema = ["dep:schemars"]
1919
serde = ["dep:serde"]
2020

2121
[dev-dependencies]

crates/pglt_text_size/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ mod traits;
2626
#[cfg(feature = "serde")]
2727
mod serde_impls;
2828

29+
#[cfg(feature = "schema")]
30+
mod schemars_impls;
31+
2932
pub use crate::{range::TextRange, size::TextSize, traits::TextLen};
3033

3134
#[cfg(target_pointer_width = "16")]

crates/pglt_treesitter_queries/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ tree_sitter_sql.workspace = true
2020

2121
[lib]
2222
doctest = false
23-
24-
[features]

crates/pglt_type_resolver/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ pglt_schema_cache.workspace = true
1919

2020
[lib]
2121
doctest = false
22-
23-
[features]

crates/pglt_typecheck/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ pglt_test_utils.workspace = true
2828

2929
[lib]
3030
doctest = false
31-
32-
[features]

crates/pglt_workspace/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pglt_statement_splitter = { workspace = true }
2929
pglt_text_size.workspace = true
3030
pglt_typecheck = { workspace = true }
3131
rustc-hash = { workspace = true }
32+
schemars = { workspace = true, optional = true }
3233
serde = { workspace = true, features = ["derive"] }
3334
serde_json = { workspace = true, features = ["raw_value"] }
3435
sqlx.workspace = true
@@ -38,10 +39,12 @@ tracing = { workspace = true, features = ["attributes", "log"]
3839
tree-sitter.workspace = true
3940
tree_sitter_sql.workspace = true
4041

42+
43+
[features]
44+
schema = ["dep:schemars", "pglt_configuration/schema", "pglt_fs/schema"]
45+
4146
[dev-dependencies]
4247
tempfile = "3.15.0"
4348

4449
[lib]
4550
doctest = false
46-
47-
[features]

0 commit comments

Comments
 (0)