Skip to content

Commit 2867d08

Browse files
committed
Avoid cloning app config where possible
1 parent 7cdddbf commit 2867d08

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl App {
4444
/// - GitHub OAuth
4545
/// - Database connection pools
4646
/// - A `git2::Repository` instance from the index repo checkout (that server.rs ensures exists)
47-
pub fn new(config: &Config, http_client: Option<Client>) -> App {
47+
pub fn new(config: Config, http_client: Option<Client>) -> App {
4848
use oauth2::prelude::*;
4949
use oauth2::{AuthUrl, ClientId, ClientSecret, Scope, TokenUrl};
5050
use url::Url;
@@ -126,7 +126,7 @@ impl App {
126126
read_only_replica_database,
127127
github,
128128
session_key: config.session_key.clone(),
129-
config: config.clone(),
129+
config,
130130
http_client,
131131
}
132132
}

src/bin/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2727
let config = cargo_registry::Config::default();
2828
let client = Client::new();
2929

30-
let app = App::new(&config, Some(client));
30+
let app = App::new(config.clone(), Some(client));
3131
let app = cargo_registry::build_handler(Arc::new(app));
3232

3333
// On every server restart, ensure the categories available in the database match

src/tests/all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn build_app(
160160
None
161161
};
162162

163-
let app = App::new(&config, client);
163+
let app = App::new(config, client);
164164
t!(t!(app.primary_database.get()).begin_test_transaction());
165165
let app = Arc::new(app);
166166
let handler = cargo_registry::build_handler(Arc::clone(&app));

0 commit comments

Comments
 (0)