laysakura / serde-encrypt

πŸ” Encrypts all the Serialize.
Apache License 2.0
177 stars 6 forks source link

fix(lint): fix lint problesm from cargo clippy #108

Closed kurikomoe closed 2 years ago

kurikomoe commented 2 years ago

Just fix lint problems, mostly remove the useless &s, as the clippy suggests.

Close #107

codecov[bot] commented 2 years ago

Codecov Report

Merging #108 (4109eb4) into main (1366793) will decrease coverage by 0.93%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   83.14%   82.21%   -0.94%     
==========================================
  Files          45       45              
  Lines        2474     2502      +28     
==========================================
  Hits         2057     2057              
- Misses        417      445      +28     
Impacted Files Coverage Ξ”
serde-encrypt-core/src/key/combined_key.rs 93.75% <100.00%> (ΓΈ)
...rde-encrypt/src/traits/serde_encrypt_public_key.rs 100.00% <100.00%> (ΓΈ)
...rde-encrypt/src/traits/serde_encrypt_shared_key.rs 100.00% <100.00%> (ΓΈ)
...c/traits/serde_encrypt_shared_key_deterministic.rs 28.57% <100.00%> (-71.43%) :arrow_down:
..._serde_encrypt_public_key_struct_with_reference.rs 100.00% <100.00%> (ΓΈ)
...encrypt_shared_key_encryption_with_key_exchange.rs 100.00% <100.00%> (ΓΈ)
...essage_shared_key/shared_key_deterministic_core.rs 55.55% <0.00%> (-44.45%) :arrow_down:
serde-encrypt-core/src/error.rs 17.15% <0.00%> (ΓΈ)

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 1366793...4109eb4. Read the comment docs.

laysakura commented 2 years ago

@kurikomoe I appreciate your work! Could you fix additional lint errors?

error: this expression creates a reference which is immediately dereferenced by the compiler
  --> serde-encrypt/tests/example_serde_encrypt_shared_key_encryption_with_key_exchange.rs:48:53
   |
48 |     SharedKey::decrypt_owned(&encrypted_shared_key, &combined_key)
   |                                                     ^^^^^^^^^^^^^ help: change this to: `combined_key`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

error: this expression creates a reference which is immediately dereferenced by the compiler
  --> serde-encrypt/tests/example_serde_encrypt_public_key_struct_with_reference.rs:46:62
   |
46 |     let decrypted = Message::decrypt_ref(&encrypted_message, &combined_key)?;
   |                                                              ^^^^^^^^^^^^^ help: change this to: `combined_key`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

error: this expression creates a reference which is immediately dereferenced by the compiler
  --> serde-encrypt/tests/example_serde_encrypt_shared_key_encryption_with_key_exchange.rs:[81](https://github.com/laysakura/serde-encrypt/runs/6004047638?check_suite_focus=true#step:9:81):62
   |
81 |     let decrypted = Message::decrypt_ref(&encrypted_message, &shared_key)?;
   |                                                              ^^^^^^^^^^^ help: change this to: `shared_key`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
kurikomoe commented 2 years ago

Ok, i forgot to run cargo clippy --tests. fixed

laysakura commented 2 years ago

Thanks a lot!