Skip to content

Commit

Permalink
feat(status): implement Hash for StatusCode
Browse files Browse the repository at this point in the history
Change hash implementation to just use `derive(Hash)`
  • Loading branch information
Håvar Nøvik committed Jul 22, 2015
1 parent aa85f60 commit d84f291
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/status.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! HTTP status codes
use std::fmt;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};

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

impl Hash for StatusCode {
fn hash<H: Hasher>(&self, state: &mut H) {
self.to_u16().hash(state);
}
}

/// The class of an HTTP `status-code`.
///
/// [RFC 7231, section 6 (Response Status Codes)](https://tools.ietf.org/html/rfc7231#section-6):
Expand Down

0 comments on commit d84f291

Please sign in to comment.