From 03a2710a0886706621be6d68ce8b0f9bf1ab2d7d Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sat, 9 Jan 2021 15:27:54 +0100 Subject: [PATCH] =?UTF-8?q?Use=20new=20matches!(=E2=80=A6)=20macro=20to=20?= =?UTF-8?q?simplify=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/input.rs | 6 +----- src/output.rs | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/input.rs b/src/input.rs index 5b6a4e67..1e7aec2f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -137,11 +137,7 @@ impl<'a> Input<'a> { } pub fn is_stdin(&self) -> bool { - if let InputKind::StdIn = self.kind { - true - } else { - false - } + matches!(self.kind, InputKind::StdIn) } pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self { diff --git a/src/output.rs b/src/output.rs index 602bc42e..de11a9d2 100644 --- a/src/output.rs +++ b/src/output.rs @@ -150,11 +150,7 @@ impl OutputType { #[cfg(feature = "paging")] pub(crate) fn is_pager(&self) -> bool { - if let OutputType::Pager(_) = self { - true - } else { - false - } + matches!(self, OutputType::Pager(_)) } #[cfg(not(feature = "paging"))]