Skip to content

Commit 8dd6db4

Browse files
committed
Auto merge of #13748 - epage:kebab, r=weihanglo
refactor(config): Consistently use kebab-case This shouldn't change the behavior but makes it safer if - We add new fields where it will matter - Copy/paste these for new structs I did not change things related to the Index because we are already stuck with that case (whether we want it or not) Came across this when working on #13540 and almost made the mistake of copying what was already there
2 parents 48eca1b + bb46cce commit 8dd6db4

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/cargo/ops/cargo_new.rs

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl NewOptions {
131131
}
132132

133133
#[derive(Deserialize)]
134+
#[serde(rename_all = "kebab-case")]
134135
struct CargoNewConfig {
135136
#[deprecated = "cargo-new no longer supports adding the authors field"]
136137
#[allow(dead_code)]

src/cargo/sources/directory.rs

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub struct DirectorySource<'gctx> {
7070
/// The file name is simply `.cargo-checksum.json`. The checksum algorithm as
7171
/// of now is SHA256.
7272
#[derive(Deserialize)]
73+
#[serde(rename_all = "kebab-case")]
7374
struct Checksum {
7475
/// Checksum of the package. Normally it is computed from the `.crate` file.
7576
package: Option<String>,

src/cargo/sources/registry/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ pub const CRATES_IO_DOMAIN: &str = "crates.io";
227227
/// The content inside `.cargo-ok`.
228228
/// See [`RegistrySource::unpack_package`] for more.
229229
#[derive(Deserialize, Serialize)]
230+
#[serde(rename_all = "kebab-case")]
230231
struct LockMetadata {
231232
/// The version of `.cargo-ok` file
232233
v: u32,

src/cargo/util/context/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,7 @@ impl<'de> Deserialize<'de> for SslVersionConfig {
25142514
}
25152515

25162516
#[derive(Clone, Debug, Deserialize, PartialEq)]
2517+
#[serde(rename_all = "kebab-case")]
25172518
pub struct SslVersionConfigRange {
25182519
pub min: Option<String>,
25192520
pub max: Option<String>,
@@ -2644,6 +2645,7 @@ impl BuildTargetConfig {
26442645
}
26452646

26462647
#[derive(Deserialize, Default)]
2648+
#[serde(rename_all = "kebab-case")]
26472649
pub struct TermConfig {
26482650
pub verbose: Option<bool>,
26492651
pub quiet: Option<bool>,
@@ -2656,13 +2658,14 @@ pub struct TermConfig {
26562658
}
26572659

26582660
#[derive(Debug, Default, Deserialize)]
2661+
#[serde(rename_all = "kebab-case")]
26592662
pub struct ProgressConfig {
26602663
pub when: ProgressWhen,
26612664
pub width: Option<usize>,
26622665
}
26632666

26642667
#[derive(Debug, Default, Deserialize)]
2665-
#[serde(rename_all = "lowercase")]
2668+
#[serde(rename_all = "kebab-case")]
26662669
pub enum ProgressWhen {
26672670
#[default]
26682671
Auto,

0 commit comments

Comments
 (0)