misc-errors: Allow or make error enums non_exhaustive
This commit is contained in:
		
							parent
							
								
									fd310e5b6e
								
							
						
					
					
						commit
						c55dab7122
					
				| @ -4,6 +4,7 @@ use std::fmt; | ||||
| 
 | ||||
| /// An error encountered when trying to parse an invalid ID string.
 | ||||
| #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] | ||||
| #[non_exhaustive] | ||||
| pub enum Error { | ||||
|     /// The client secret is empty.
 | ||||
|     EmptyClientSecret, | ||||
|  | ||||
| @ -24,6 +24,7 @@ pub fn to_string<T: Serialize>(val: &T) -> Result<String, Error> { | ||||
| 
 | ||||
| /// The set of possible errors when serializing to canonical JSON.
 | ||||
| #[derive(Debug)] | ||||
| #[allow(clippy::exhaustive_enums)] | ||||
| pub enum Error { | ||||
|     /// The numeric value failed conversion to js_int::Int.
 | ||||
|     IntConvert, | ||||
|  | ||||
| @ -15,6 +15,7 @@ pub type Object = BTreeMap<String, CanonicalJsonValue>; | ||||
| 
 | ||||
| /// Represents a canonical JSON value as per the Matrix specification.
 | ||||
| #[derive(Clone, Eq, PartialEq)] | ||||
| #[allow(clippy::exhaustive_enums)] | ||||
| pub enum CanonicalJsonValue { | ||||
|     /// Represents a JSON null value.
 | ||||
|     ///
 | ||||
|  | ||||
| @ -52,6 +52,7 @@ impl<'input, 'output, Target: UrlEncodedTarget> Serializer<'input, 'output, Targ | ||||
| 
 | ||||
| /// Errors returned during serializing to `application/x-www-form-urlencoded`.
 | ||||
| #[derive(Clone, Debug, PartialEq, Eq)] | ||||
| #[non_exhaustive] | ||||
| pub enum Error { | ||||
|     /// UTF-8 validation failed.
 | ||||
|     Utf8(str::Utf8Error), | ||||
|  | ||||
| @ -109,6 +109,7 @@ impl JsonError { | ||||
| 
 | ||||
| /// A JSON type enum for [`JsonError`] variants.
 | ||||
| #[derive(Debug)] | ||||
| #[allow(clippy::exhaustive_enums)] | ||||
| pub enum JsonType { | ||||
|     /// A JSON Object.
 | ||||
|     Object, | ||||
| @ -253,6 +254,7 @@ impl ParseError { | ||||
| 
 | ||||
| /// An error when trying to extract the algorithm and version from a key identifier.
 | ||||
| #[derive(Error, Debug)] | ||||
| #[non_exhaustive] | ||||
| pub enum SplitError { | ||||
|     /// The signature's ID does not have exactly two components separated by a colon.
 | ||||
|     #[error("malformed signature ID: expected exactly 2 segment separated by a colon, found {0}")] | ||||
|  | ||||
| @ -50,6 +50,7 @@ impl Verifier for Ed25519Verifier { | ||||
| /// that the event has been redacted. In this case, receiving homeservers should store a redacted
 | ||||
| /// version of the event.
 | ||||
| #[derive(Clone, Debug, Hash, PartialEq)] | ||||
| #[allow(clippy::exhaustive_enums)] | ||||
| pub enum Verified { | ||||
|     /// All signatures are valid and the content hashes match.
 | ||||
|     All, | ||||
|  | ||||
| @ -6,6 +6,7 @@ pub type Result<T> = std::result::Result<T, Error>; | ||||
| 
 | ||||
| /// Represents the various errors that arise when resolving state.
 | ||||
| #[derive(Error, Debug)] | ||||
| #[non_exhaustive] | ||||
| pub enum Error { | ||||
|     /// A deserialization error.
 | ||||
|     #[error(transparent)] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user