Use new matches!(…) macro to simplify code
commit03a2710a0886706621be6d68ce8b0f9bf1ab2d7d
authorsharkdp <davidpeter@web.de>
dateSat 9 Jan 2021, 15:27 (6 years ago)
parent09fbabb
src/input.rs+1−5
@@ -137,11 +137,7 @@ impl<'a> Input<'a> {
137137 }
138138
139139 pub fn is_stdin(&self) -> bool {
140− if let InputKind::StdIn = self.kind {
141− true
142− } else {
143− false
144− }
140+ matches!(self.kind, InputKind::StdIn)
145141 }
146142
147143 pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
src/output.rs+1−5
@@ -150,11 +150,7 @@ impl OutputType {
150150
151151 #[cfg(feature = "paging")]
152152 pub(crate) fn is_pager(&self) -> bool {
153− if let OutputType::Pager(_) = self {
154− true
155− } else {
156− false
157− }
153+ matches!(self, OutputType::Pager(_))
158154 }
159155
160156 #[cfg(not(feature = "paging"))]