Skip to content

Commit 26cb678

Browse files
committed
arc -> &
1 parent 2e06798 commit 26cb678

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apps/fortuna/src/api.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ pub struct ApiState {
7878

7979
pub explorer_metrics: Arc<ExplorerMetrics>,
8080

81-
pub config: Arc<Config>,
81+
pub config: Config,
8282
}
8383

8484
impl ApiState {
8585
pub async fn new(
8686
chains: Arc<RwLock<HashMap<ChainId, ApiBlockChainState>>>,
8787
metrics_registry: Arc<RwLock<Registry>>,
8888
history: Arc<History>,
89-
config: Arc<Config>,
89+
config: &Config,
9090
) -> ApiState {
9191
let metrics = ApiMetrics {
9292
http_requests: Family::default(),
@@ -354,7 +354,7 @@ mod test {
354354
Arc::new(RwLock::new(chains)),
355355
metrics_registry,
356356
Arc::new(History::new().await.unwrap()),
357-
Arc::new(config),
357+
&config,
358358
)
359359
.await;
360360

@@ -678,7 +678,7 @@ mod test {
678678
Arc::new(RwLock::new(HashMap::new())),
679679
metrics_registry,
680680
Arc::new(History::new().await.unwrap()),
681-
Arc::new(config),
681+
&config,
682682
)
683683
.await;
684684

apps/fortuna/src/command/run.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub async fn run_api(
2828
chains: Arc<RwLock<HashMap<String, ApiBlockChainState>>>,
2929
metrics_registry: Arc<RwLock<Registry>>,
3030
history: Arc<History>,
31-
config: Arc<Config>,
31+
config: &Config,
3232
mut rx_exit: watch::Receiver<bool>,
3333
) -> Result<()> {
3434
#[derive(OpenApi)]
@@ -55,7 +55,7 @@ pub async fn run_api(
5555
)]
5656
struct ApiDoc;
5757

58-
let api_state = api::ApiState::new(chains, metrics_registry, history, config.clone()).await;
58+
let api_state = api::ApiState::new(chains, metrics_registry, history, config).await;
5959

6060
// Initialize Axum Router. Note the type here is a `Router<State>` due to the use of the
6161
// `with_state` method which replaces `Body` with `State` in the type signature.
@@ -87,7 +87,7 @@ pub async fn run_api(
8787
pub async fn run(opts: &RunOptions) -> Result<()> {
8888
// Load environment variables from a .env file if present
8989
let _ = dotenv::dotenv().map_err(|e| anyhow!("Failed to load .env file: {}", e))?;
90-
let config = Arc::new(Config::load(&opts.config.config)?);
90+
let config = Config::load(&opts.config.config)?;
9191
let secret = config.provider.secret.load()?.ok_or(anyhow!(
9292
"Please specify a provider secret in the config file."
9393
))?;
@@ -171,7 +171,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
171171
chains.clone(),
172172
metrics_registry.clone(),
173173
history,
174-
config.clone(),
174+
&config,
175175
rx_exit,
176176
)
177177
.await?;

0 commit comments

Comments
 (0)