use if let vs match

This commit is contained in:
jdeepee 2020-10-28 11:03:06 +00:00
parent b04bc9af21
commit deb09109f6
1 changed files with 6 additions and 3 deletions

View File

@ -133,9 +133,12 @@ impl Logger {
) -> Self { ) -> Self {
let inner = Rc::get_mut(&mut self.0).unwrap(); let inner = Rc::get_mut(&mut self.0).unwrap();
let pos = inner.format.0.iter().position(|tf| match tf { let pos = inner.format.0.iter().position(|tf| {
FormatText::CustomRequest(inner_label, _) => label == inner_label, if let FormatText::CustomRequest(inner_label, _) = tf {
_ => false, label == inner_label
} else {
false
}
}); });
match pos { match pos {
Some(pos) => match &mut inner.format.0[pos] { Some(pos) => match &mut inner.format.0[pos] {