Skip to content

Commit e4c55c1

Browse files
refactor(hm-config): Mark public config structs #[non_exhaustive] (#120)
1 parent ec21dd2 commit e4c55c1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

crates/hm-config/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn default_backend() -> String {
2222
}
2323

2424
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
25+
#[non_exhaustive]
2526
pub struct CloudConfig {
2627
pub org: Option<String>,
2728
pub api_url: String,
@@ -37,6 +38,7 @@ impl Default for CloudConfig {
3738
}
3839

3940
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
41+
#[non_exhaustive]
4042
pub struct Preferences {
4143
pub format: String,
4244
pub auto_watch: bool,
@@ -52,6 +54,7 @@ impl Default for Preferences {
5254
}
5355

5456
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
57+
#[non_exhaustive]
5558
pub struct Config {
5659
#[serde(default = "default_backend")]
5760
pub backend: String,
@@ -264,12 +267,11 @@ org = "project-org"
264267
let tmp = tempfile::tempdir().unwrap();
265268
let path = tmp.path().join("config.toml");
266269
let cfg = Config {
267-
backend: default_backend(),
268270
cloud: CloudConfig {
269271
org: Some("saved-org".into()),
270-
api_url: DEFAULT_API_URL.to_owned(),
272+
..CloudConfig::default()
271273
},
272-
preferences: Preferences::default(),
274+
..Config::default()
273275
};
274276
cfg.save_to(&path).unwrap();
275277

0 commit comments

Comments
 (0)