Skip to content

Commit fc6cad5

Browse files
authored
Remove unnecessary checks in baseparser (#112)
## Why https://github.com/ruby/rexml/blob/444c9ce7449d3c5a75ae50087555ec73ae1963a8/lib/rexml/parsers/baseparser.rb#L352-L425 ``` next_data = @source.buffer if next_data.size < 2 @source.read next_data = @source.buffer end if next_data[0] == ?< : (omit) : else # next_data is a string of one or more characters other than '<'. md = @source.match( TEXT_PATTERN, true ) # TEXT_PATTERN = /\A([^<]*)/um text = md[1] if md[0].length == 0 # md[0].length is greater than or equal to 1. @source.match( /(\s+)/, true ) end ``` This is an unnecessary check because md[0].length is greater than or equal to 1.
1 parent 444c9ce commit fc6cad5

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/rexml/parsers/baseparser.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ def pull_event
420420
else
421421
md = @source.match( TEXT_PATTERN, true )
422422
text = md[1]
423-
if md[0].length == 0
424-
@source.match( /(\s+)/, true )
425-
end
426423
return [ :text, text ]
427424
end
428425
rescue REXML::UndefinedNamespaceException

0 commit comments

Comments
 (0)