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
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