aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servoparser/html.rs
diff options
context:
space:
mode:
authorbors-servo <infra@servo.org>2023-06-22 14:21:16 +0200
committerGitHub <noreply@github.com>2023-06-22 14:21:16 +0200
commit5ac7cdc18d3073fff35d0aff5af29b2ee066ae8a (patch)
treeeae7f75adccdff0a58ed44172c6a8effc183d6c8 /components/script/dom/servoparser/html.rs
parenta98dcfffe0d10f57bb483c75c5363783e7231ae3 (diff)
parent41fe94244a7b6442fe2e06f114a45f122dda36c4 (diff)
downloadservo-5ac7cdc18d3073fff35d0aff5af29b2ee066ae8a.tar.gz
servo-5ac7cdc18d3073fff35d0aff5af29b2ee066ae8a.zip
Auto merge of #25623 - nipunG314:25516, r=mrobinson
Refactor ServoParser Tokenizer to return TokenizerResult As stated in #25516, this PR refactors the feed functions in the following files to return an Option instead of a Result: - components/script/dom/servoparser/async_html.rs - components/script/dom/servoparser/html.rs - components/script/dom/servoparser/xml.rs - components/script/dom/servoparser/mod.rs Originally, these functions were returning the Err values for situations that didn't actually result in an error. This PR fixes that. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25516 <!-- Either: --> - [X] These changes do not require tests because it is a refactor. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/servoparser/html.rs')
-rw-r--r--components/script/dom/servoparser/html.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs
index 1bbc0aeeae8..fbf76473d27 100644
--- a/components/script/dom/servoparser/html.rs
+++ b/components/script/dom/servoparser/html.rs
@@ -77,10 +77,13 @@ impl Tokenizer {
Tokenizer { inner: inner }
}
- pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot<HTMLScriptElement>> {
+ #[must_use]
+ pub fn feed(&mut self, input: &mut BufferQueue) -> TokenizerResult<DomRoot<HTMLScriptElement>> {
match self.inner.feed(input) {
- TokenizerResult::Done => Ok(()),
- TokenizerResult::Script(script) => Err(DomRoot::from_ref(script.downcast().unwrap())),
+ TokenizerResult::Done => TokenizerResult::Done,
+ TokenizerResult::Script(script) => {
+ TokenizerResult::Script(DomRoot::from_ref(script.downcast().unwrap()))
+ },
}
}