Skip to content

Commit

Permalink
Remove unnecessary cloning (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivnsch authored Jul 31, 2020
1 parent ccd9ea4 commit 1bdad3a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions src/database/alert_dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -369,7 +369,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -424,7 +424,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -480,7 +480,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -538,7 +538,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -599,7 +599,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -652,7 +652,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down Expand Up @@ -705,7 +705,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let alert_dao = AlertDaoImpl::new(database.clone());
let alert_dao = AlertDaoImpl::new(database);

let symptoms = PublicSymptoms {
report_time: UnixTime { value: 0 },
Expand Down
6 changes: 3 additions & 3 deletions src/database/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let preferences_dao = PreferencesDao::new(database.clone());
let preferences_dao = PreferencesDao::new(database);
let preferences = PreferencesImpl {
dao: preferences_dao,
};
Expand All @@ -258,7 +258,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let preferences_dao = PreferencesDao::new(database.clone());
let preferences_dao = PreferencesDao::new(database);
let preferences = PreferencesImpl {
dao: preferences_dao,
};
Expand All @@ -275,7 +275,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let preferences_dao = PreferencesDao::new(database.clone());
let preferences_dao = PreferencesDao::new(database);
let preferences = PreferencesImpl {
dao: preferences_dao,
};
Expand Down
8 changes: 4 additions & 4 deletions src/database/tcn_dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = TcnDaoImpl::new(database.clone());
let tcn_dao = TcnDaoImpl::new(database);

let observed_tcn = ObservedTcn {
tcn: TemporaryContactNumber([
Expand Down Expand Up @@ -202,7 +202,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = TcnDaoImpl::new(database.clone());
let tcn_dao = TcnDaoImpl::new(database);

let observed_tcn_1 = ObservedTcn {
tcn: TemporaryContactNumber([
Expand Down Expand Up @@ -258,7 +258,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let stored_tcn1 = ObservedTcn {
tcn: TemporaryContactNumber([0; 16]),
Expand Down Expand Up @@ -316,7 +316,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let batches_manager =
TcnBatchesManager::new(tcn_dao.clone(), ExposureGrouper { threshold: 1000 });
Expand Down
12 changes: 6 additions & 6 deletions src/tcn_recording/tcn_batches_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = TcnDaoImpl::new(database.clone());
let tcn_dao = TcnDaoImpl::new(database);

let batches_manager =
TcnBatchesManager::new(Arc::new(tcn_dao), ExposureGrouper { threshold: 1000 });
Expand Down Expand Up @@ -242,7 +242,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = TcnDaoImpl::new(database.clone());
let tcn_dao = TcnDaoImpl::new(database);

let batches_manager =
TcnBatchesManager::new(Arc::new(tcn_dao), ExposureGrouper { threshold: 1000 });
Expand All @@ -268,7 +268,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let batches_manager =
TcnBatchesManager::new(tcn_dao.clone(), ExposureGrouper { threshold: 1000 });
Expand Down Expand Up @@ -299,7 +299,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let batches_manager =
TcnBatchesManager::new(tcn_dao.clone(), ExposureGrouper { threshold: 1000 });
Expand Down Expand Up @@ -352,7 +352,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let batches_manager =
TcnBatchesManager::new(tcn_dao.clone(), ExposureGrouper { threshold: 1000 });
Expand Down Expand Up @@ -419,7 +419,7 @@ mod tests {
let database = Arc::new(Database::new(
Connection::open_in_memory().expect("Couldn't create database!"),
));
let tcn_dao = Arc::new(TcnDaoImpl::new(database.clone()));
let tcn_dao = Arc::new(TcnDaoImpl::new(database));

let batches_manager =
TcnBatchesManager::new(tcn_dao.clone(), ExposureGrouper { threshold: 1000 });
Expand Down

0 comments on commit 1bdad3a

Please sign in to comment.