Skip to content

Commit 6b07ee4

Browse files
XAMPPRockyseanmonstar
authored andcommitted
Refactor Method::is_idempotent for readability (#348)
1 parent 6856193 commit 6b07ee4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/method.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,9 @@ impl Method {
219219
/// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.2) for
220220
/// more words.
221221
pub fn is_idempotent(&self) -> bool {
222-
if self.is_safe() {
223-
true
224-
} else {
225-
match self.0 {
226-
Put | Delete => true,
227-
_ => false
228-
}
222+
match self.0 {
223+
Put | Delete | _ if self.is_safe() => true,
224+
_ => false
229225
}
230226
}
231227

0 commit comments

Comments
 (0)