@@ -28,7 +28,6 @@ use chacha20poly1305::{
28
28
aead:: { Aead , Error as EncryptionError } ,
29
29
Key as ChachaKey , KeyInit , XChaCha20Poly1305 , XNonce ,
30
30
} ;
31
- use displaydoc:: Display ;
32
31
use hmac:: Hmac ;
33
32
use pbkdf2:: pbkdf2;
34
33
use rand:: { thread_rng, Error as RandomError , Fill } ;
@@ -46,26 +45,39 @@ const BASE64: GeneralPurpose = GeneralPurpose::new(&alphabet::STANDARD, general_
46
45
type MacKeySeed = [ u8 ; 32 ] ;
47
46
48
47
/// Error type for the `StoreCipher` operations.
49
- #[ derive( Debug , Display , thiserror:: Error ) ]
48
+ #[ derive( Debug , thiserror:: Error ) ]
50
49
pub enum Error {
51
- /// Failed to serialize a value {0}
50
+ /// Failed to serialize a value.
51
+ #[ error( "Failed to serialize a value: `{0}`" ) ]
52
52
Serialization ( #[ from] rmp_serde:: encode:: Error ) ,
53
- /// Failed to deserialize a value {0}
53
+
54
+ /// Failed to deserialize a value.
55
+ #[ error( "Failed to deserialize a value: `{0}`" ) ]
54
56
Deserialization ( #[ from] rmp_serde:: decode:: Error ) ,
55
- /// Failed to deserialize or serialize a JSON value {0}
57
+
58
+ /// Failed to deserialize or serialize a JSON value.
59
+ #[ error( "Failed to deserialize or serialize a JSON value: `{0}`" ) ]
56
60
Json ( #[ from] serde_json:: Error ) ,
57
- /// Error encrypting or decrypting a value {0}
61
+
62
+ /// Error encrypting or decrypting a value.
63
+ #[ error( "Error encrypting or decrypting a value: `{0}`" ) ]
58
64
Encryption ( #[ from] EncryptionError ) ,
59
- /// Couldn't generate enough randomness for a cryptographic operation: {0}
65
+
66
+ /// Could not generate enough randomness for a cryptographic operation: {0}
67
+ #[ error( "Could not generate enough randomness for a cryptographic operation: `{0}`" ) ]
60
68
Random ( #[ from] RandomError ) ,
61
- /// Unsupported ciphertext version, expected {0}, got {1}
69
+
70
+ /// Unsupported ciphertext version.
71
+ #[ error( "Unsupported ciphertext version, expected `{0}`, got `{1}`" ) ]
62
72
Version ( u8 , u8 ) ,
63
- /// The ciphertext had an invalid length, expected {0}, got {1}
73
+
74
+ /// The ciphertext had an invalid length.
75
+ #[ error( "The ciphertext had an invalid length, expected `{0}`, got `{1}`" ) ]
64
76
Length ( usize , usize ) ,
65
- /**
66
- * Failed to import a store cipher, the export used a passphrase while
67
- * we're trying to import it using a key or vice-versa.
68
- */
77
+
78
+ /// Failed to import a store cipher, the export used a passphrase while
79
+ /// we are trying to import it using a key or vice-versa.
80
+ # [ error ( "Failed to import a store cipher, the export used a passphrase while we are trying to import it using a key or vice-versa" ) ]
69
81
KdfMismatch ,
70
82
}
71
83
0 commit comments