on master help sign in
Use new matches!(…) macro to simplify code
03a2710sharkdp
src/input.rs+1−5
@@ -137,11 +137,7 @@ impl<'a> Input<'a> {
137 }
137 }
138
138
139 pub fn is_stdin(&self) -> bool {
139 pub fn is_stdin(&self) -> bool {
140− if let InputKind::StdIn = self.kind {
140+ matches!(self.kind, InputKind::StdIn)
141− true
142− } else {
143− false
144− }
145 }
141 }
146
142
147 pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
143 pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
src/output.rs+1−5
@@ -150,11 +150,7 @@ impl OutputType {
150
150
151 #[cfg(feature = "paging")]
151 #[cfg(feature = "paging")]
152 pub(crate) fn is_pager(&self) -> bool {
152 pub(crate) fn is_pager(&self) -> bool {
153− if let OutputType::Pager(_) = self {
153+ matches!(self, OutputType::Pager(_))
154− true
155− } else {
156− false
157− }
158 }
154 }
159
155
160 #[cfg(not(feature = "paging"))]
156 #[cfg(not(feature = "paging"))]