File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ struct BacktraceOccurrences {
44
44
backtrace : Arc < Backtrace > ,
45
45
}
46
46
47
- /// Backtrace of scanning xml tags.
47
+ /// Backtrace of scanned xml tags.
48
48
#[ derive( Default ) ]
49
49
struct TagBacktrace {
50
50
backtrace : Vec < CurrentTag > ,
@@ -55,18 +55,18 @@ impl TagBacktrace {
55
55
self . backtrace . push ( tag) ;
56
56
}
57
57
58
- /// Remove the top tag and return it. Return `Err(())` on tag mismatching .
59
- fn collide ( & mut self , name : & [ u8 ] ) -> Result < CurrentTag , ( ) > {
58
+ /// If `name` matches the top tag of the stack, the tag is popped .
59
+ fn pop_with_name ( & mut self , name : & [ u8 ] ) -> Option < CurrentTag > {
60
60
if self
61
61
. backtrace
62
62
. last ( )
63
63
. map ( |t| t. matches ( name) )
64
64
. unwrap_or_default ( )
65
65
{
66
66
// There is at least one element in backtrace, hence this unwrap is safe.
67
- Ok ( self . backtrace . pop ( ) . unwrap ( ) )
67
+ Some ( self . backtrace . pop ( ) . unwrap ( ) )
68
68
} else {
69
- Err ( ( ) )
69
+ None
70
70
}
71
71
}
72
72
@@ -309,7 +309,7 @@ impl Folder {
309
309
}
310
310
Event :: End ( end) => {
311
311
let name = end. name ( ) . into_inner ( ) ;
312
- let state = match context. state_backtrace . collide ( name) {
312
+ let state = match context. state_backtrace . pop_with_name ( name) {
313
313
Ok ( state) => state,
314
314
Err ( ( ) ) => {
315
315
return invalid_data_error ! (
You can’t perform that action at this time.
0 commit comments