Skip to content

Commit d84f291

Browse files
author
Håvar Nøvik
committed
feat(status): implement Hash for StatusCode
Change hash implementation to just use `derive(Hash)`
1 parent aa85f60 commit d84f291

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/status.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! HTTP status codes
22
use std::fmt;
33
use std::cmp::Ordering;
4-
use std::hash::{Hash, Hasher};
54

65
// shamelessly lifted from Teepee. I tried a few schemes, this really
76
// does seem like the best. Improved scheme to support arbitrary status codes.
@@ -29,7 +28,7 @@ use std::hash::{Hash, Hasher};
2928
/// Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) which is
3029
/// the source for this enum (with one exception, 418 I'm a teapot, which is
3130
/// inexplicably not in the register).
32-
#[derive(Debug)]
31+
#[derive(Debug, Hash)]
3332
pub enum StatusCode {
3433
/// 100 Continue
3534
/// [[RFC7231, Section 6.2.1](https://tools.ietf.org/html/rfc7231#section-6.2.1)]
@@ -534,12 +533,6 @@ impl Ord for StatusCode {
534533
}
535534
}
536535

537-
impl Hash for StatusCode {
538-
fn hash<H: Hasher>(&self, state: &mut H) {
539-
self.to_u16().hash(state);
540-
}
541-
}
542-
543536
/// The class of an HTTP `status-code`.
544537
///
545538
/// [RFC 7231, section 6 (Response Status Codes)](https://tools.ietf.org/html/rfc7231#section-6):

0 commit comments

Comments
 (0)