Skip to content

Commit c54a267

Browse files
committed
Use is_some_and
1 parent dde90c0 commit c54a267

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/collapse/xctrace.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use super::{
6262
```
6363
*/
6464

65-
6665
// ----------- attribute names -----------
6766

6867
/// Reference to a previous declared backtrace/frame, it's value is id.
@@ -124,17 +123,10 @@ impl TagBacktrace {
124123

125124
/// If `name` matches the top tag of the stack, the tag is popped.
126125
fn pop_with_name(&mut self, name: &[u8]) -> Option<CurrentTag> {
127-
if self
128-
.backtrace
126+
self.backtrace
129127
.last()
130-
.map(|t| t.matches(name))
131-
.unwrap_or_default()
132-
{
133-
// There is at least one element in backtrace, hence this unwrap is safe.
134-
Some(self.backtrace.pop().unwrap())
135-
} else {
136-
None
137-
}
128+
.is_some_and(|t| t.matches(name))
129+
.then(|| self.backtrace.pop())?
138130
}
139131

140132
fn top_mut(&mut self) -> Option<&mut CurrentTag> {

0 commit comments

Comments
 (0)