Skip to content

Commit

Permalink
Refactor Method::is_idempotent for readability (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky authored and seanmonstar committed Nov 26, 2019
1 parent 6856193 commit 6b07ee4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,9 @@ impl Method {
/// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.2) for
/// more words.
pub fn is_idempotent(&self) -> bool {
if self.is_safe() {
true
} else {
match self.0 {
Put | Delete => true,
_ => false
}
match self.0 {
Put | Delete | _ if self.is_safe() => true,
_ => false
}
}

Expand Down

0 comments on commit 6b07ee4

Please sign in to comment.