Skip to content

Commit

Permalink
Merge branch 'tim/clippy_extra_ref' into 'master'
Browse files Browse the repository at this point in the history
clippy: Apply --fix for needless borrows

See merge request TankerHQ/sdk-rust!52
  • Loading branch information
tux3 committed Aug 13, 2021
2 parents cd60f8e + 37f4c29 commit 94989bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions tests/identity/admin/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ fn serialized_block(
let mut data = Vec::new();
data.extend(serialized_varint(BLOCK_FORMAT_VERSION));
data.extend(serialized_varint(index));
data.extend_from_slice(&trustchain_id);
data.extend_from_slice(trustchain_id);

data.extend(serialized_varint(nature));
data.extend(serialized_varint(payload.len() as u64));
data.extend_from_slice(&payload);
data.extend_from_slice(payload);

data.extend_from_slice(author);
data.extend_from_slice(&signature);
data.extend_from_slice(signature);

data
}
Expand Down
2 changes: 1 addition & 1 deletion tests/identity/test_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl TestApp {

pub async fn start_anonymous(&self, identity: &str) -> Result<Core, Error> {
let tanker = Core::new(self.make_options()).await?;
let status = tanker.start(&identity).await?;
let status = tanker.start(identity).await?;
assert_eq!(status, Status::IdentityRegistrationNeeded);

let key = tanker.generate_verification_key().await?;
Expand Down
32 changes: 16 additions & 16 deletions tests/verify_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async fn validate_new_device_with_verif_key() -> Result<(), Error> {
let id = &app.create_identity(None);

let tanker = Core::new(app.make_options()).await?;
assert_eq!(tanker.start(&id).await?, Status::IdentityRegistrationNeeded);
assert_eq!(tanker.start(id).await?, Status::IdentityRegistrationNeeded);
let key = Verification::VerificationKey(tanker.generate_verification_key().await?);
tanker
.register_identity(&key, &VerificationOptions::new())
Expand All @@ -19,7 +19,7 @@ async fn validate_new_device_with_verif_key() -> Result<(), Error> {
tanker.stop().await?;

let tanker = Core::new(app.make_options()).await?;
assert_eq!(tanker.start(&id).await?, Status::IdentityVerificationNeeded);
assert_eq!(tanker.start(id).await?, Status::IdentityVerificationNeeded);
tanker
.verify_identity(&key, &VerificationOptions::new())
.await?;
Expand All @@ -33,15 +33,15 @@ async fn setup_and_use_passphrase() -> Result<(), Error> {
let id = &app.create_identity(None);
let pass = Verification::Passphrase("The Beauty In The Ordinary".into());
let tanker = Core::new(app.make_options()).await?;
assert_eq!(tanker.start(&id).await?, Status::IdentityRegistrationNeeded);
assert_eq!(tanker.start(id).await?, Status::IdentityRegistrationNeeded);
tanker
.register_identity(&pass, &VerificationOptions::new())
.await?;
assert_eq!(tanker.status(), Status::Ready);
tanker.stop().await?;

let tanker = Core::new(app.make_options()).await?;
assert_eq!(tanker.start(&id).await?, Status::IdentityVerificationNeeded);
assert_eq!(tanker.start(id).await?, Status::IdentityVerificationNeeded);
tanker
.verify_identity(&pass, &VerificationOptions::new())
.await?;
Expand All @@ -58,15 +58,15 @@ async fn unlock_with_updated_passphrase() -> Result<(), Error> {

let verif_options = &VerificationOptions::new();
let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker.register_identity(&first_pass, verif_options).await?;
tanker
.set_verification_method(&second_pass, verif_options)
.await?;
tanker.stop().await?;

let tanker = Core::new(app.make_options()).await?;
assert_eq!(tanker.start(&id).await?, Status::IdentityVerificationNeeded);
assert_eq!(tanker.start(id).await?, Status::IdentityVerificationNeeded);
tanker.verify_identity(&second_pass, verif_options).await?;
assert_eq!(tanker.status(), Status::Ready);
tanker.stop().await
Expand All @@ -79,7 +79,7 @@ async fn check_passphrase_is_setup() -> Result<(), Error> {
let pass = Verification::Passphrase("The Cost of Legacy".into());

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker
.register_identity(&pass, &VerificationOptions::new())
.await?;
Expand All @@ -101,7 +101,7 @@ async fn check_email_verif_is_setup() -> Result<(), Error> {
};

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker
.register_identity(&verif, &VerificationOptions::new())
.await?;
Expand All @@ -123,7 +123,7 @@ async fn check_sms_verif_is_setup() -> Result<(), Error> {
};

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker
.register_identity(&verif, &VerificationOptions::new())
.await?;
Expand All @@ -141,21 +141,21 @@ async fn unlock_with_verif_code() -> Result<(), Error> {
let email = "[email protected]";

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
let verif = Verification::Email {
email: email.to_owned(),
verification_code: app.get_email_verification_code(&email).await?,
verification_code: app.get_email_verification_code(email).await?,
};
tanker
.register_identity(&verif, &VerificationOptions::new())
.await?;
tanker.stop().await?;

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
let verif = Verification::Email {
email: email.to_owned(),
verification_code: app.get_email_verification_code(&email).await?,
verification_code: app.get_email_verification_code(email).await?,
};
tanker
.verify_identity(&verif, &VerificationOptions::new())
Expand Down Expand Up @@ -216,7 +216,7 @@ async fn get_session_token_with_register_identity() -> Result<(), Error> {
let pass = Verification::Passphrase("The Cost of Legacy".into());

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
let token = tanker
.register_identity(&pass, &VerificationOptions::new().with_session_token())
.await?;
Expand All @@ -234,7 +234,7 @@ async fn get_session_token_with_verify_identity() -> Result<(), Error> {
let pass = Verification::Passphrase("Merge remote-tracking branch 'rust/rust-next'".into());

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker
.register_identity(&pass, &VerificationOptions::new())
.await?;
Expand All @@ -257,7 +257,7 @@ async fn get_session_token_with_set_verififcation_method() -> Result<(), Error>
let pass2 = Verification::Passphrase("Deimos".into());

let tanker = Core::new(app.make_options()).await?;
tanker.start(&id).await?;
tanker.start(id).await?;
tanker
.register_identity(&pass, &VerificationOptions::new())
.await?;
Expand Down

0 comments on commit 94989bd

Please sign in to comment.