spruceid / ssi

Core library for decentralized identity.
https://spruceid.dev
Apache License 2.0
193 stars 61 forks source link

Address cargo clippy warnings #399

Closed clehner closed 2 years ago

clehner commented 2 years ago

The following Cargo clippy warnings and warnings should be addressed.

cargo clippy --workspace @ e6d7e7b6218ba87d13162d71f2db58b348908071 ``` Checking ssi v0.4.0 (/home/cel/src/ssi) warning: associated function is never used: `as_struct_mut` --> src/eip712.rs:240:8 | 240 | fn as_struct_mut(&mut self) -> Option<&mut HashMap> { | ^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: unneeded `return` statement --> src/did_resolve.rs:892:5 | 892 | return (res_meta, result.did_document, result.did_document_metadata); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `(res_meta, result.did_document, result.did_document_metadata)` | = note: `#[warn(clippy::needless_return)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/did_resolve.rs:927:51 | 927 | percent_encoding::utf8_percent_encode(&did, percent_encoding::CONTROLS).to_string(); | ^^^^ help: change this to: `did` | = note: `#[warn(clippy::needless_borrow)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: `to_string` applied to a type that implements `Display` in `format!` args --> src/did_resolve.rs:953:28 | 953 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = note: `#[warn(clippy::to_string_in_format_args)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `to_string` applied to a type that implements `Display` in `format!` args --> src/did_resolve.rs:1102:28 | 1102 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` --> src/eip712.rs:1038:40 | 1038 | let mut values = array.into_iter(); | ^^^^^^^^^ help: call directly: `iter` | = note: `#[warn(clippy::into_iter_on_ref)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/jws.rs:175:48 | 175 | let hash = crate::hash::sha256(&data)?; | ^^^^^ help: change this to: `data` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/revocation.rs:277:9 | 277 | / match revocation_list_credential.validate() { 278 | | Err(e) => { 279 | | return result.with_error(format!("Invalid list credential: {}", e)); 280 | | } 281 | | Ok(()) => {} 282 | | } | |_________^ | = note: `#[warn(clippy::single_match)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try this | 277 ~ if let Err(e) = revocation_list_credential.validate() { 278 + return result.with_error(format!("Invalid list credential: {}", e)); 279 + } | warning: `ssi` (lib) generated 8 warnings Checking did-onion v0.1.2 (/home/cel/src/ssi/did-onion) Checking did-sol v0.0.1 (/home/cel/src/ssi/did-sol) Checking did-tz v0.1.2 (/home/cel/src/ssi/did-tezos) Checking did-method-key v0.1.3 (/home/cel/src/ssi/did-key) Checking did-pkh v0.1.1 (/home/cel/src/ssi/did-pkh) Checking did-webkey v0.1.1 (/home/cel/src/ssi/did-webkey) Checking did-web v0.1.2 (/home/cel/src/ssi/did-web) warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-onion/src/lib.rs:119:28 | 119 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = note: `#[warn(clippy::to_string_in_format_args)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-onion/src/lib.rs:132:28 | 132 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-onion/src/lib.rs:149:28 | 149 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `did-onion` (lib) generated 3 warnings Checking did-ion v0.1.0 (/home/cel/src/ssi/did-ion) warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-webkey/src/lib.rs:242:28 | 242 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = note: `#[warn(clippy::to_string_in_format_args)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args Checking did-ethr v0.1.1 (/home/cel/src/ssi/did-ethr) warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-webkey/src/lib.rs:259:28 | 259 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args Checking ssi-vc-test v0.1.0 (/home/cel/src/ssi/vc-test) warning: `did-webkey` (lib) generated 2 warnings warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-web/src/lib.rs:118:28 | 118 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = note: `#[warn(clippy::to_string_in_format_args)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-web/src/lib.rs:135:28 | 135 | err.to_string() | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `did-web` (lib) generated 2 warnings warning: this `impl` can be derived --> did-tezos/src/lib.rs:36:1 | 36 | / impl Default for DIDTz { 37 | | fn default() -> Self { 38 | | Self { tzkt_url: None } 39 | | } 40 | | } | |_^ | = note: `#[warn(clippy::derivable_impls)]` on by default = help: try annotating `DIDTz` with `#[derive(Default)]` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls warning: `to_string` applied to a type that implements `Display` in `format!` args --> did-tezos/src/lib.rs:428:28 | 428 | address.to_string() | ^^^^^^^^^^^^ help: remove this | = note: `#[warn(clippy::to_string_in_format_args)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args warning: `did-tz` (lib) generated 2 warnings Checking ssi-did-test v0.1.0 (/home/cel/src/ssi/did-test) warning: unused imports: `StatusCode`, `header` --> did-ion/src/sidetree.rs:5:15 | 5 | use reqwest::{header, Client, StatusCode}; | ^^^^^^ ^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: field is never read: `type` --> did-ion/src/sidetree.rs:517:5 | 517 | r#type: Option, | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default note: `PartiallyVerifiedCreateOperation` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis --> did-ion/src/sidetree.rs:514:10 | 514 | #[derive(Debug, Clone)] | ^^^^^ ^^^^^ = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) warning: field is never read: `anchor_origin` --> did-ion/src/sidetree.rs:519:5 | 519 | anchor_origin: Option, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `PartiallyVerifiedCreateOperation` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis --> did-ion/src/sidetree.rs:514:10 | 514 | #[derive(Debug, Clone)] | ^^^^^ ^^^^^ = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) warning: field is never read: `signed_anchor_origin` --> did-ion/src/sidetree.rs:542:5 | 542 | signed_anchor_origin: Option, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `PartiallyVerifiedRecoverOperation` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis --> did-ion/src/sidetree.rs:536:10 | 536 | #[derive(Debug, Clone)] | ^^^^^ ^^^^^ = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:318:54 | 318 | let update_reveal_value = Self::reveal_value(&canonicalized_update_pk.as_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `canonicalized_update_pk.as_bytes()` | = note: `#[warn(clippy::needless_borrow)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:326:37 | 326 | Self::commitment_scheme(&new_update_pk).context("Generate new update commitment")?; | ^^^^^^^^^^^^^^ help: change this to: `new_update_pk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:375:55 | 375 | let recover_reveal_value = Self::reveal_value(&canonicalized_recovery_pk.as_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `canonicalized_recovery_pk.as_bytes()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:377:37 | 377 | Self::commitment_scheme(&new_update_pk).context("Generate new update commitment")?; | ^^^^^^^^^^^^^^ help: change this to: `new_update_pk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:379:37 | 379 | Self::commitment_scheme(&new_recovery_pk).context("Generate new update commitment")?; | ^^^^^^^^^^^^^^^^ help: change this to: `new_recovery_pk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:451:55 | 451 | let recover_reveal_value = Self::reveal_value(&canonicalized_recovery_pk.as_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `canonicalized_recovery_pk.as_bytes()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: large size difference between variants --> did-test/src/main.rs:109:5 | 109 | / Resolve { 110 | | did_document: Option, 111 | | did_resolution_metadata: ResolutionMetadata, 112 | | did_document_metadata: DocumentMetadata, 113 | | }, | |_____^ this variant is 592 bytes | = note: `#[warn(clippy::large_enum_variant)]` on by default note: and the second-largest variant is 216 bytes: --> did-test/src/main.rs:121:5 | 121 | / Dereference { 122 | | dereferencing_metadata: DereferencingMetadata, 123 | | content_stream: String, 124 | | content_metadata: ContentMetadata, 125 | | }, | |_____^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant help: consider boxing the large fields to reduce the total size of the enum | 110 | did_document: Box>, | ~~~~~~~~~~~~~~~~~~~~~ warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:625:49 | 625 | let computed_reveal_value = S::reveal_value(&commitment_value); | ^^^^^^^^^^^^^^^^^ help: change this to: `commitment_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:628:30 | 628 | S::commitment_scheme(&pk).context("Unable to compute public key commitment")?; | ^^^ help: change this to: `pk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:673:21 | 673 | &update_commitment, | ^^^^^^^^^^^^^^^^^^ help: change this to: `update_commitment` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:683:21 | 683 | &recovery_commitment, | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `recovery_commitment` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:703:21 | 703 | &recovery_commitment, | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `recovery_commitment` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: for loop over a single element --> did-test/src/main.rs:284:5 | 284 | / for did in &["did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"] { 285 | | let did_vector = did_method_vector(&resolver, did).await; 286 | | did_vectors.insert(did.to_string(), did_vector); 287 | | } | |_____^ | = note: `#[warn(clippy::single_element_loop)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 284 ~ { 285 + let did = &"did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"; 286 + let did_vector = did_method_vector(&resolver, did).await; 287 + did_vectors.insert(did.to_string(), did_vector); 288 + } | warning: for loop over a single element --> did-test/src/main.rs:341:5 | 341 | / for did in &["did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"] { 342 | | let did_vector = did_method_vector(&resolver, did).await; 343 | | did_vectors.insert(did.to_string(), did_vector); 344 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 341 ~ { 342 + let did = &"did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"; 343 + let did_vector = did_method_vector(&resolver, did).await; 344 + did_vectors.insert(did.to_string(), did_vector); 345 + } | warning: for loop over a single element --> did-test/src/main.rs:511:5 | 511 | / for did in &["did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH"] { 512 | | report 513 | | .resolve_representation( 514 | | &did_method_key::DIDKey, ... | 518 | | .await; 519 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 511 ~ { 512 + let did = &"did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH"; 513 + report 514 + .resolve_representation( 515 + &did_method_key::DIDKey, 516 + did, ... warning: for loop over a single element --> did-test/src/main.rs:543:5 | 543 | / for did in &["did:web:identity.foundation"] { 544 | | report 545 | | .resolve_representation(&did_web::DIDWeb, did, &ResolutionInputMetadata::default()) 546 | | .await; 547 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 543 ~ { 544 + let did = &"did:web:identity.foundation"; 545 + report 546 + .resolve_representation(&did_web::DIDWeb, did, &ResolutionInputMetadata::default()) 547 + .await; 548 + } | warning: for loop over a single element --> did-test/src/main.rs:574:5 | 574 | / for did in &["did:tz:tz1YwA1FwpgLtc1G8DKbbZ6e6PTb1dQMRn5x"] { 575 | | report 576 | | .resolve_representation(&did_tz, did, &ResolutionInputMetadata::default()) 577 | | .await; 578 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 574 ~ { 575 + let did = &"did:tz:tz1YwA1FwpgLtc1G8DKbbZ6e6PTb1dQMRn5x"; 576 + report 577 + .resolve_representation(&did_tz, did, &ResolutionInputMetadata::default()) 578 + .await; 579 + } | warning: for loop over a single element --> did-test/src/main.rs:594:5 | 594 | / for did in &["did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"] { 595 | | report 596 | | .resolve(&resolver, did, &ResolutionInputMetadata::default()) 597 | | .await; 598 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 594 ~ { 595 + let did = &"did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"; 596 + report 597 + .resolve(&resolver, did, &ResolutionInputMetadata::default()) 598 + .await; 599 + } | warning: for loop over a single element --> did-test/src/main.rs:600:5 | 600 | / for did in &["did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"] { 601 | | report 602 | | .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 603 | | .await; 604 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 600 ~ { 601 + let did = &"did:onion:fscst5exmlmr262byztwz4kzhggjlzumvc2ndvgytzoucr2tkgxf7mid"; 602 + report 603 + .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 604 + .await; 605 + } | warning: for loop over a single element --> did-test/src/main.rs:620:5 | 620 | / for did in &["did:pkh:doge:DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L"] { 621 | | report 622 | | .resolve(&resolver, did, &ResolutionInputMetadata::default()) 623 | | .await; 624 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 620 ~ { 621 + let did = &"did:pkh:doge:DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L"; 622 + report 623 + .resolve(&resolver, did, &ResolutionInputMetadata::default()) 624 + .await; 625 + } | warning: for loop over a single element --> did-test/src/main.rs:626:5 | 626 | / for did in &["did:pkh:doge:DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L"] { 627 | | report 628 | | .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 629 | | .await; 630 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 626 ~ { 627 + let did = &"did:pkh:doge:DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L"; 628 + report 629 + .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 630 + .await; 631 + } | warning: for loop over a single element --> did-test/src/main.rs:646:5 | 646 | / for did in &["did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"] { 647 | | report 648 | | .resolve(&resolver, did, &ResolutionInputMetadata::default()) 649 | | .await; 650 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 646 ~ { 647 + let did = &"did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"; 648 + report 649 + .resolve(&resolver, did, &ResolutionInputMetadata::default()) 650 + .await; 651 + } | warning: for loop over a single element --> did-test/src/main.rs:652:5 | 652 | / for did in &["did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"] { 653 | | report 654 | | .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 655 | | .await; 656 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_element_loop help: try | 652 ~ { 653 + let did = &"did:webkey:ssh:demo.spruceid.com:2021:07:14:keys"; 654 + report 655 + .resolve_representation(&resolver, did, &ResolutionInputMetadata::default()) 656 + .await; 657 + } | warning: `ssi-did-test` (bin "ssi-did-test") generated 12 warnings warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/sidetree.rs:1412:53 | 1412 | .map(|url| HTTPSidetreeDIDResolver::new(&url)); | ^^^^ help: change this to: `url` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow error: this loop never actually loops --> did-ion/src/sidetree.rs:1596:9 | 1596 | / for opt in options.keys() { 1597 | | return Err(DIDMethodError::OptionNotSupported { 1598 | | operation: "create", 1599 | | option: opt.clone(), 1600 | | }); 1601 | | } | |_________^ | = note: `#[deny(clippy::never_loop)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop help: if you need the first element of the iterator, try writing | 1596 | if let Some(opt) = options.keys().next() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this loop never actually loops --> did-ion/src/sidetree.rs:1676:9 | 1676 | / for opt in options.keys() { 1677 | | return Err(DIDMethodError::OptionNotSupported { 1678 | | operation: "update", 1679 | | option: opt.clone(), 1680 | | }); 1681 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop help: if you need the first element of the iterator, try writing | 1676 | if let Some(opt) = options.keys().next() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this loop never actually loops --> did-ion/src/sidetree.rs:1708:9 | 1708 | / for opt in options.keys() { 1709 | | return Err(DIDMethodError::OptionNotSupported { 1710 | | operation: "recover", 1711 | | option: opt.clone(), 1712 | | }); 1713 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop help: if you need the first element of the iterator, try writing | 1708 | if let Some(opt) = options.keys().next() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: this loop never actually loops --> did-ion/src/sidetree.rs:1739:9 | 1739 | / for opt in options.keys() { 1740 | | return Err(DIDMethodError::OptionNotSupported { 1741 | | operation: "deactivate", 1742 | | option: opt.clone(), 1743 | | }); 1744 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop help: if you need the first element of the iterator, try writing | 1739 | if let Some(opt) = options.keys().next() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: this expression creates a reference which is immediately dereferenced by the compiler --> did-ion/src/lib.rs:20:26 | 20 | if !is_secp256k1(&key) { | ^^^^ help: change this to: `key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow warning: `did-ion` (lib) generated 17 warnings error: could not compile `did-ion` due to 4 previous errors; 17 warnings emitted ```
chunningham commented 2 years ago

I believe this is closed by #467