@@ -31,6 +31,7 @@ use std::cmp::Ordering;
31
31
/// Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) which is
32
32
/// the source for this enum (with one exception, 418 I'm a teapot, which is
33
33
/// inexplicably not in the register).
34
+ #[ derive( Debug ) ]
34
35
pub enum StatusCode {
35
36
/// 100 Continue
36
37
/// [[RFC7231, Section 6.2.1](https://tools.ietf.org/html/rfc7231#section-6.2.1)]
@@ -305,7 +306,7 @@ impl StatusCode {
305
306
306
307
StatusCode :: NotExtended => Some ( "Not Extended" ) ,
307
308
StatusCode :: NetworkAuthenticationRequired => Some ( "Network Authentication Required" ) ,
308
- _ => None
309
+ StatusCode :: Unregistered ( .. ) => None
309
310
}
310
311
}
311
312
@@ -379,86 +380,6 @@ impl fmt::Display for StatusCode {
379
380
}
380
381
}
381
382
382
- impl fmt:: Debug for StatusCode {
383
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
384
- let s = match * self {
385
- StatusCode :: Continue => "Continue" ,
386
- StatusCode :: SwitchingProtocols => "SwitchingProtocols" ,
387
- StatusCode :: Processing => "Processing" ,
388
-
389
- StatusCode :: Ok => "Ok" ,
390
- StatusCode :: Created => "Created" ,
391
- StatusCode :: Accepted => "Accepted" ,
392
- StatusCode :: NonAuthoritativeInformation => "NonAuthoritativeInformation" ,
393
- StatusCode :: NoContent => "NoContent" ,
394
- StatusCode :: ResetContent => "ResetContent" ,
395
- StatusCode :: PartialContent => "PartialContent" ,
396
- StatusCode :: MultiStatus => "MultiStatus" ,
397
- StatusCode :: AlreadyReported => "AlreadyReported" ,
398
-
399
- StatusCode :: ImUsed => "ImUsed" ,
400
-
401
- StatusCode :: MultipleChoices => "MultipleChoices" ,
402
- StatusCode :: MovedPermanently => "MovedPermanently" ,
403
- StatusCode :: Found => "Found" ,
404
- StatusCode :: SeeOther => "SeeOther" ,
405
- StatusCode :: NotModified => "NotModified" ,
406
- StatusCode :: UseProxy => "UseProxy" ,
407
-
408
- StatusCode :: TemporaryRedirect => "TemporaryRedirect" ,
409
- StatusCode :: PermanentRedirect => "PermanentRedirect" ,
410
-
411
- StatusCode :: BadRequest => "BadRequest" ,
412
- StatusCode :: Unauthorized => "Unauthorized" ,
413
- StatusCode :: PaymentRequired => "PaymentRequired" ,
414
- StatusCode :: Forbidden => "Forbidden" ,
415
- StatusCode :: NotFound => "NotFound" ,
416
- StatusCode :: MethodNotAllowed => "MethodNotAllowed" ,
417
- StatusCode :: NotAcceptable => "NotAcceptable" ,
418
- StatusCode :: ProxyAuthenticationRequired => "ProxyAuthenticationRequired" ,
419
- StatusCode :: RequestTimeout => "RequestTimeout" ,
420
- StatusCode :: Conflict => "Conflict" ,
421
- StatusCode :: Gone => "Gone" ,
422
- StatusCode :: LengthRequired => "LengthRequired" ,
423
- StatusCode :: PreconditionFailed => "PreconditionFailed" ,
424
- StatusCode :: PayloadTooLarge => "PayloadTooLarge" ,
425
- StatusCode :: UriTooLong => "UriTooLong" ,
426
- StatusCode :: UnsupportedMediaType => "UnsupportedMediaType" ,
427
- StatusCode :: RangeNotSatisfiable => "RangeNotSatisfiable" ,
428
- StatusCode :: ExpectationFailed => "ExpectationFailed" ,
429
- StatusCode :: ImATeapot => "ImATeapot" ,
430
-
431
- StatusCode :: UnprocessableEntity => "UnprocessableEntity" ,
432
- StatusCode :: Locked => "Locked" ,
433
- StatusCode :: FailedDependency => "FailedDependency" ,
434
-
435
- StatusCode :: UpgradeRequired => "UpgradeRequired" ,
436
-
437
- StatusCode :: PreconditionRequired => "PreconditionRequired" ,
438
- StatusCode :: TooManyRequests => "TooManyRequests" ,
439
-
440
- StatusCode :: RequestHeaderFieldsTooLarge => "RequestHeaderFieldsTooLarge" ,
441
-
442
- StatusCode :: InternalServerError => "InternalServerError" ,
443
- StatusCode :: NotImplemented => "NotImplemented" ,
444
- StatusCode :: BadGateway => "BadGateway" ,
445
- StatusCode :: ServiceUnavailable => "ServiceUnavailable" ,
446
- StatusCode :: GatewayTimeout => "GatewayTimeout" ,
447
- StatusCode :: HttpVersionNotSupported => "HttpVersionNotSupported" ,
448
- StatusCode :: VariantAlsoNegotiates => "VariantAlsoNegotiates" ,
449
- StatusCode :: InsufficientStorage => "InsufficientStorage" ,
450
- StatusCode :: LoopDetected => "LoopDetected" ,
451
-
452
- StatusCode :: NotExtended => "NotExtended" ,
453
- StatusCode :: NetworkAuthenticationRequired => "NetworkAuthenticationRequired" ,
454
- StatusCode :: Unregistered ( ref code) => {
455
- return write ! ( f, "Unregistered({})" , code) ;
456
- }
457
- } ;
458
- f. write_str ( s)
459
- }
460
- }
461
-
462
383
impl PartialEq for StatusCode {
463
384
#[ inline]
464
385
fn eq ( & self , other : & StatusCode ) -> bool {
0 commit comments