Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 48b6013

Browse files
committed
Move the sub-configuration path to an associated constant
1 parent 1cf2833 commit 48b6013

File tree

15 files changed

+19
-53
lines changed

15 files changed

+19
-53
lines changed

crates/config/src/sections/branding.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ pub struct BrandingConfig {
4646

4747
#[async_trait]
4848
impl ConfigurationSection for BrandingConfig {
49-
fn path() -> &'static str {
50-
"branding"
51-
}
49+
const PATH: Option<&'static str> = Some("branding");
5250

5351
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
5452
where

crates/config/src/sections/clients.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ impl IntoIterator for ClientsConfig {
181181

182182
#[async_trait]
183183
impl ConfigurationSection for ClientsConfig {
184-
fn path() -> &'static str {
185-
"clients"
186-
}
184+
const PATH: Option<&'static str> = Some("clients");
187185

188186
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
189187
where

crates/config/src/sections/database.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,7 @@ pub struct DatabaseConfig {
146146

147147
#[async_trait]
148148
impl ConfigurationSection for DatabaseConfig {
149-
fn path() -> &'static str {
150-
"database"
151-
}
149+
const PATH: Option<&'static str> = Some("database");
152150

153151
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
154152
where

crates/config/src/sections/email.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ impl Default for EmailConfig {
128128

129129
#[async_trait]
130130
impl ConfigurationSection for EmailConfig {
131-
fn path() -> &'static str {
132-
"email"
133-
}
131+
const PATH: Option<&'static str> = Some("email");
134132

135133
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
136134
where

crates/config/src/sections/experimental.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ impl Default for ExperimentalConfig {
5656

5757
#[async_trait]
5858
impl ConfigurationSection for ExperimentalConfig {
59-
fn path() -> &'static str {
60-
"experimental"
61-
}
59+
const PATH: Option<&'static str> = Some("experimental");
6260

6361
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
6462
where

crates/config/src/sections/http.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,7 @@ impl Default for HttpConfig {
394394

395395
#[async_trait]
396396
impl ConfigurationSection for HttpConfig {
397-
fn path() -> &'static str {
398-
"http"
399-
}
397+
const PATH: Option<&'static str> = Some("http");
400398

401399
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
402400
where

crates/config/src/sections/matrix.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ pub struct MatrixConfig {
5050

5151
#[async_trait]
5252
impl ConfigurationSection for MatrixConfig {
53-
fn path() -> &'static str {
54-
"matrix"
55-
}
53+
const PATH: Option<&'static str> = Some("matrix");
5654

5755
async fn generate<R>(mut rng: R) -> anyhow::Result<Self>
5856
where

crates/config/src/sections/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ pub struct RootConfig {
116116

117117
#[async_trait]
118118
impl ConfigurationSection for RootConfig {
119-
fn path() -> &'static str {
120-
""
121-
}
122-
123119
async fn generate<R>(mut rng: R) -> anyhow::Result<Self>
124120
where
125121
R: Rng + Send,
@@ -195,10 +191,6 @@ pub struct AppConfig {
195191

196192
#[async_trait]
197193
impl ConfigurationSection for AppConfig {
198-
fn path() -> &'static str {
199-
""
200-
}
201-
202194
async fn generate<R>(mut rng: R) -> anyhow::Result<Self>
203195
where
204196
R: Rng + Send,
@@ -251,10 +243,6 @@ pub struct SyncConfig {
251243

252244
#[async_trait]
253245
impl ConfigurationSection for SyncConfig {
254-
fn path() -> &'static str {
255-
""
256-
}
257-
258246
async fn generate<R>(mut rng: R) -> anyhow::Result<Self>
259247
where
260248
R: Rng + Send,

crates/config/src/sections/passwords.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ impl Default for PasswordsConfig {
5757

5858
#[async_trait]
5959
impl ConfigurationSection for PasswordsConfig {
60-
fn path() -> &'static str {
61-
"passwords"
62-
}
60+
const PATH: Option<&'static str> = Some("passwords");
6361

6462
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
6563
where

crates/config/src/sections/policy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ impl Default for PolicyConfig {
106106

107107
#[async_trait]
108108
impl ConfigurationSection for PolicyConfig {
109-
fn path() -> &'static str {
110-
"policy"
111-
}
109+
const PATH: Option<&'static str> = Some("policy");
112110

113111
async fn generate<R>(_rng: R) -> anyhow::Result<Self>
114112
where

0 commit comments

Comments
 (0)