From 0c6315f24ba71c3641a7721ea4e38864a443fbe0 Mon Sep 17 00:00:00 2001 From: Erin Power Date: Mon, 28 Oct 2019 18:05:23 +0100 Subject: [PATCH] Refactor Method::is_idempotent --- src/method.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/method.rs b/src/method.rs index 702b08ac..1631de00 100644 --- a/src/method.rs +++ b/src/method.rs @@ -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 } }