Skip to content

Challenge-response for attestation #422

Challenge-response for attestation

Challenge-response for attestation #422

Triggered via pull request January 12, 2024 14:55
@sgreenburysgreenbury
synchronize #162
94-cr-cli
Status Success
Total duration 4m 23s
Artifacts

rust.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

64 warnings
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-cli/src/bin/main.rs#L513
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-cli/src/bin/main.rs:513:65 | 513 | initiate_content_challenge(&path, ddid, &services, &attestor_public_key) | ^^^^^^^^^ help: change this to: `services` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-cli/src/bin/main.rs#L439
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-cli/src/bin/main.rs:439:73 | 439 | let identity_challenge = present_identity_challenge(&did, &temp_p_key)?; | ^^^^ help: change this to: `did` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
unused `std::result::Result` that must be used: trustchain-http/src/attestor.rs#L188
warning: unused `std::result::Result` that must be used --> trustchain-http/src/attestor.rs:188:9 | 188 | content_initiation.elementwise_serialize(&path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 188 | let _ = content_initiation.elementwise_serialize(&path); | +++++++
redundant closure: trustchain-http/src/requester.rs#L306
warning: redundant closure --> trustchain-http/src/requester.rs:306:18 | 306 | .map_err(|err| TrustchainCRError::Reqwest(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Reqwest` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
used `unwrap()` on `Some` value: trustchain-http/src/requester.rs#L278
warning: used `unwrap()` on `Some` value --> trustchain-http/src/requester.rs:278:34 | 278 | ... &Some(Value::from(nonce.clone())).unwrap(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap = note: `#[warn(clippy::unnecessary_literal_unwrap)]` on by default help: remove the `Some` and `unwrap()` | 278 - &Some(Value::from(nonce.clone())).unwrap(), 278 + &Value::from(nonce.clone()), |
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L250
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:250:41 | 250 | let ion_attestor = IONAttestor::new(&ddid); | ^^^^^ help: change this to: `ddid` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L226
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:226:83 | 226 | let identity_initiation = IdentityCRInitiation::new().elementwise_deserialize(&path); | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L194
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:194:9 | 194 | &path, | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
redundant closure: trustchain-http/src/requester.rs#L189
warning: redundant closure --> trustchain-http/src/requester.rs:189:18 | 189 | .map_err(|err| TrustchainCRError::Reqwest(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Reqwest` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
redundant closure: trustchain-http/src/requester.rs#L180
warning: redundant closure --> trustchain-http/src/requester.rs:180:18 | 180 | .map_err(|err| TrustchainCRError::Reqwest(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Reqwest` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L160
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:160:34 | 160 | .elementwise_deserialize(&path) | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
redundant closure: trustchain-http/src/requester.rs#L125
warning: redundant closure --> trustchain-http/src/requester.rs:125:18 | 125 | .map_err(|err| TrustchainCRError::Reqwest(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Reqwest` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L111
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:111:75 | 111 | .sign_and_encrypt_claim(&decrypted_verified_payload, &temp_s_key, &attestor_p_key) | ^^^^^^^^^^^^^^^ help: change this to: `attestor_p_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/requester.rs#L106
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/requester.rs:106:13 | 106 | &attestor_p_key, | ^^^^^^^^^^^^^^^ help: change this to: `attestor_p_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
redundant closure: trustchain-http/src/requester.rs#L63
warning: redundant closure --> trustchain-http/src/requester.rs:63:18 | 63 | .map_err(|err| TrustchainCRError::Reqwest(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Reqwest` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L375
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:375:34 | 375 | .elementwise_deserialize(&path) | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L359
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:359:65 | 359 | attestor.sign_and_encrypt_claim(&payload, &signing_key, &temp_p_key); | ^^^^^^^^^^^ help: change this to: `temp_p_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L354
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:354:28 | 354 | ssi_to_josekit_jwk(&signing_key_ssi).map_err(|_| TrustchainCRError::FailedToGenerateKey)?; | ^^^^^^^^^^^^^^^^ help: change this to: `signing_key_ssi` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L286
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:286:46 | 286 | let signing_key = ssi_to_josekit_jwk(&signing_key_ssi).unwrap(); | ^^^^^^^^^^^^^^^^ help: change this to: `signing_key_ssi` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
the borrowed expression implements the required traits: trustchain-http/src/attestor.rs#L271
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestor.rs:271:34 | 271 | let path = pathbase.join(&key_id); | ^^^^^^^ help: change this to: `key_id` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L223
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:223:46 | 223 | let signing_key = ssi_to_josekit_jwk(&signing_key_ssi).unwrap(); | ^^^^^^^^^^^^^^^^ help: change this to: `signing_key_ssi` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L209
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:209:29 | 209 | ... &requester_keys.get(key_id).unwrap(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `requester_keys.get(key_id).unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
statement with no effect: trustchain-http/src/attestor.rs#L150
warning: statement with no effect --> trustchain-http/src/attestor.rs:150:17 | 150 | (StatusCode::BAD_REQUEST, response); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect
statement with no effect: trustchain-http/src/attestor.rs#L143
warning: statement with no effect --> trustchain-http/src/attestor.rs:143:17 | 143 | (StatusCode::OK, respone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect = note: `#[warn(clippy::no_effect)]` on by default
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestor.rs#L122
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestor.rs:122:46 | 122 | let signing_key = ssi_to_josekit_jwk(&signing_key_ssi).unwrap(); | ^^^^^^^^^^^^^^^^ help: change this to: `signing_key_ssi` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
the borrowed expression implements the required traits: trustchain-http/src/attestor.rs#L109
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestor.rs:109:34 | 109 | let path = pathbase.join(&key_id); | ^^^^^^^ help: change this to: `key_id` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L789
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:789:5 | 789 | return Ok(endpoints[0].clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 789 - return Ok(endpoints[0].clone()); 789 + Ok(endpoints[0].clone()) |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L763
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:763:13 | 763 | return String::from("Challenge-response complete."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 763 - return String::from("Challenge-response complete."); 763 + String::from("Challenge-response complete.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L760
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:760:13 | 760 | return String::from("Content challenge has been presented. Await response."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 760 - return String::from("Content challenge has been presented. Await response."); 760 + String::from("Content challenge has been presented. Await response.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L757
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:757:13 | 757 | return String::from("Content challenge-response initiated. Await response."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 757 - return String::from("Content challenge-response initiated. Await response."); 757 + String::from("Content challenge-response initiated. Await response.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L754
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:754:13 | 754 | return String::from("Identity challenge-response complete."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 754 - return String::from("Identity challenge-response complete."); 754 + String::from("Identity challenge-response complete.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L751
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:751:13 | 751 | return String::from("Identity challenge has been presented. Await response."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 751 - return String::from("Identity challenge has been presented. Await response."); 751 + String::from("Identity challenge has been presented. Await response.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L748
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:748:13 | 748 | return String::from("Identity challenge-response initiated. Await response."); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 748 - return String::from("Identity challenge-response initiated. Await response."); 748 + String::from("Identity challenge-response initiated. Await response.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L745
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:745:13 | 745 | ... return String::from("No records found for this challenge-response identifier or entity. \nThe challenge-response process has not been initiated yet.... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 745 - return String::from("No records found for this challenge-response identifier or entity. \nThe challenge-response process has not been initiated yet."); 745 + String::from("No records found for this challenge-response identifier or entity. \nThe challenge-response process has not been initiated yet.") |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L705
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:705:9 | 705 | return Ok(current_state); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 705 - return Ok(current_state); 705 + Ok(current_state) |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L622
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:622:9 | 622 | return false; | ^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 622 - return false; 622 + false |
you should consider adding a `Default` implementation for `CRState`: trustchain-http/src/attestation_utils.rs#L593
warning: you should consider adding a `Default` implementation for `CRState` --> trustchain-http/src/attestation_utils.rs:593:5 | 593 | / pub fn new() -> Self { 594 | | Self { 595 | | identity_cr_initiation: None, 596 | | identity_challenge_response: None, ... | 599 | | } 600 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 592 + impl Default for CRState { 593 + fn default() -> Self { 594 + Self::new() 595 + } 596 + } |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L525
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:525:9 | 525 | return self.challenge_complete() && self.content_response_signature.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 525 - return self.challenge_complete() && self.content_response_signature.is_some(); 525 + self.challenge_complete() && self.content_response_signature.is_some() |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L521
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:521:9 | 521 | return self.content_nonce.is_some() && self.content_challenge_signature.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 521 - return self.content_nonce.is_some() && self.content_challenge_signature.is_some(); 521 + self.content_nonce.is_some() && self.content_challenge_signature.is_some() |
you should consider adding a `Default` implementation for `ContentCRChallenge`: trustchain-http/src/attestation_utils.rs#L512
warning: you should consider adding a `Default` implementation for `ContentCRChallenge` --> trustchain-http/src/attestation_utils.rs:512:5 | 512 | / pub fn new() -> Self { 513 | | Self { 514 | | content_nonce: None, 515 | | content_challenge_signature: None, 516 | | content_response_signature: None, 517 | | } 518 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 511 + impl Default for ContentCRChallenge { 512 + fn default() -> Self { 513 + Self::new() 514 + } 515 + } |
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L485
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:485:47 | 485 | self.requester_did = match File::open(&requester_details_path) { | ^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `requester_details_path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L474
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:474:9 | 474 | return self.requester_did.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 474 - return self.requester_did.is_some(); 474 + self.requester_did.is_some() |
you should consider adding a `Default` implementation for `ContentCRInitiation`: trustchain-http/src/attestation_utils.rs#L467
warning: you should consider adding a `Default` implementation for `ContentCRInitiation` --> trustchain-http/src/attestation_utils.rs:467:5 | 467 | / pub fn new() -> Self { 468 | | Self { 469 | | requester_did: None, 470 | | } 471 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 466 + impl Default for ContentCRInitiation { 467 + fn default() -> Self { 468 + Self::new() 469 + } 470 + } |
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L349
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:349:46 | 349 | self.update_p_key = match File::open(&full_path) { | ^^^^^^^^^^ help: change this to: `full_path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L337
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:337:9 | 337 | return self.challenge_complete() && self.identity_response_signature.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 337 - return self.challenge_complete() && self.identity_response_signature.is_some(); 337 + self.challenge_complete() && self.identity_response_signature.is_some() |
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L331
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:331:9 | 331 | / return self.update_p_key.is_some() 332 | | && self.identity_nonce.is_some() 333 | | && self.identity_challenge_signature.is_some(); | |__________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return help: remove `return` | 331 ~ self.update_p_key.is_some() 332 + && self.identity_nonce.is_some() 333 ~ && self.identity_challenge_signature.is_some() |
you should consider adding a `Default` implementation for `IdentityCRChallenge`: trustchain-http/src/attestation_utils.rs#L319
warning: you should consider adding a `Default` implementation for `IdentityCRChallenge` --> trustchain-http/src/attestation_utils.rs:319:5 | 319 | / pub fn new() -> Self { 320 | | Self { 321 | | update_p_key: None, 322 | | update_s_key: None, ... | 326 | | } 327 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 318 + impl Default for IdentityCRChallenge { 319 + fn default() -> Self { 320 + Self::new() 321 + } 322 + } |
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L285
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:285:51 | 285 | self.requester_details = match File::open(&requester_details_path) { | ^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `requester_details_path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L274
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:274:44 | 274 | self.temp_s_key = match File::open(&temp_s_key_path) { | ^^^^^^^^^^^^^^^^ help: change this to: `temp_s_key_path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L253
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:253:44 | 253 | self.temp_p_key = match File::open(&temp_p_key_path) { | ^^^^^^^^^^^^^^^^ help: change this to: `temp_p_key_path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
unneeded `return` statement: trustchain-http/src/attestation_utils.rs#L242
warning: unneeded `return` statement --> trustchain-http/src/attestation_utils.rs:242:9 | 242 | return self.temp_p_key.is_some() && self.requester_details.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: `#[warn(clippy::needless_return)]` on by default help: remove `return` | 242 - return self.temp_p_key.is_some() && self.requester_details.is_some(); 242 + self.temp_p_key.is_some() && self.requester_details.is_some() |
you should consider adding a `Default` implementation for `IdentityCRInitiation`: trustchain-http/src/attestation_utils.rs#L232
warning: you should consider adding a `Default` implementation for `IdentityCRInitiation` --> trustchain-http/src/attestation_utils.rs:232:5 | 232 | / pub fn new() -> Self { 233 | | Self { 234 | | temp_p_key: None, 235 | | temp_s_key: None, 236 | | requester_details: None, 237 | | } 238 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 231 + impl Default for IdentityCRInitiation { 232 + fn default() -> Self { 233 + Self::new() 234 + } 235 + } |
writing `&PathBuf` instead of `&Path` involves a new object where a slice will do: trustchain-http/src/attestation_utils.rs#L177
warning: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do --> trustchain-http/src/attestation_utils.rs:177:44 | 177 | fn elementwise_deserialize(self, path: &PathBuf) -> Result<Option<Self>, TrustchainCRError> | ^^^^^^^^ help: change this to: `&Path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
the borrowed expression implements the required traits: trustchain-http/src/attestation_utils.rs#L163
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_utils.rs:163:34 | 163 | serde_json::to_value(&self).map_err(|_| TrustchainCRError::FailedToSerialize)?; | ^^^^^ help: change this to: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
writing `&PathBuf` instead of `&Path` involves a new object where a slice will do: trustchain-http/src/attestation_utils.rs#L161
warning: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do --> trustchain-http/src/attestation_utils.rs:161:43 | 161 | fn elementwise_serialize(&self, path: &PathBuf) -> Result<(), TrustchainCRError> { | ^^^^^^^^ help: change this to: `&Path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `#[warn(clippy::ptr_arg)]` on by default
you should consider adding a `Default` implementation for `Nonce`: trustchain-http/src/attestation_utils.rs#L117
warning: you should consider adding a `Default` implementation for `Nonce` --> trustchain-http/src/attestation_utils.rs:117:5 | 117 | / pub fn new() -> Self { 118 | | Self( 119 | | thread_rng() 120 | | .sample_iter(&Alphanumeric) ... | 124 | | ) 125 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default = note: `#[warn(clippy::new_without_default)]` on by default help: try adding this | 116 + impl Default for Nonce { 117 + fn default() -> Self { 118 + Self::new() 119 + } 120 + } |
redundant closure: trustchain-http/src/attestation_encryption_utils.rs#L123
warning: redundant closure --> trustchain-http/src/attestation_encryption_utils.rs:123:58 | 123 | ssi_to_josekit_jwk(&key).map_err(|err| TrustchainCRError::Serde(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TrustchainCRError::Serde` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure = note: `#[warn(clippy::redundant_closure)]` on by default
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`: trustchain-http/src/attestation_encryption_utils.rs#L114
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> trustchain-http/src/attestation_encryption_utils.rs:114:13 | 114 | / match vm { 115 | | VerificationMethod::Map(vm_map) => { 116 | | let key = vm_map 117 | | .get_jwk() ... | 126 | | _ => (), 127 | | } | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match = note: `#[warn(clippy::single_match)]` on by default help: try | 114 ~ if let VerificationMethod::Map(vm_map) = vm { 115 + let key = vm_map 116 + .get_jwk() 117 + .map_err(|_| TrustchainCRError::MissingJWK)?; 118 + let id = key 119 + .thumbprint() 120 + .map_err(|_| TrustchainCRError::MissingJWK)?; 121 + let key_jose = 122 + ssi_to_josekit_jwk(&key).map_err(|err| TrustchainCRError::Serde(err))?; 123 + my_map.insert(id, key_jose); 124 + } |
the borrowed expression implements the required traits: trustchain-http/src/attestation_encryption_utils.rs#L75
warning: the borrowed expression implements the required traits --> trustchain-http/src/attestation_encryption_utils.rs:75:13 | 75 | &payload.claim("claim").unwrap().as_str().unwrap(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `payload.claim("claim").unwrap().as_str().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestation_encryption_utils.rs#L59
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestation_encryption_utils.rs:59:52 | 59 | let decrypter = ECDH_ES.decrypter_from_jwk(&secret_key)?; | ^^^^^^^^^^^ help: change this to: `secret_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestation_encryption_utils.rs#L52
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestation_encryption_utils.rs:52:31 | 52 | self.encrypt(&claims, &public_key) | ^^^^^^^^^^^ help: change this to: `public_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestation_encryption_utils.rs#L38
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestation_encryption_utils.rs:38:52 | 38 | let encrypter = ECDH_ES.encrypter_from_jwk(&public_key)?; | ^^^^^^^^^^^ help: change this to: `public_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: trustchain-http/src/attestation_encryption_utils.rs#L25
warning: this expression creates a reference which is immediately dereferenced by the compiler --> trustchain-http/src/attestation_encryption_utils.rs:25:45 | 25 | let signer = ES256K.signer_from_jwk(&secret_key)?; | ^^^^^^^^^^^ help: change this to: `secret_key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
clippy_check
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/