From f8bcc3c44291610cbfce059e0a44c87912eeec28 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 09:17:02 +0100 Subject: [PATCH 01/16] Avoid using a closure that returns the unit type with Option::map() https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn --- xml5ever/src/tree_builder/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xml5ever/src/tree_builder/mod.rs b/xml5ever/src/tree_builder/mod.rs index 35940560..6913a98f 100644 --- a/xml5ever/src/tree_builder/mod.rs +++ b/xml5ever/src/tree_builder/mod.rs @@ -248,7 +248,9 @@ where for e in self.open_elems.iter() { tracer.trace_handle(&e); } - self.curr_elem.as_ref().map(|h| tracer.trace_handle(&h)); + if let Some(h) = self.curr_elem.as_ref() { + tracer.trace_handle(&h); + } } // Debug helper From 2fd21bcc666aaa4abb43f811e41c63639a877516 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 09:33:25 +0100 Subject: [PATCH 02/16] Suppress clippy warnings about loops that never loop Each match arm consistently contains a loop here, not all of them actually loop though. Silence clippy as it probbably makes sense to keep the code as is. https://rust-lang.github.io/rust-clippy/master/index.html#never_loop --- html5ever/src/tokenizer/mod.rs | 1 + xml5ever/src/tokenizer/mod.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/html5ever/src/tokenizer/mod.rs b/html5ever/src/tokenizer/mod.rs index 061363b8..6f17b429 100644 --- a/html5ever/src/tokenizer/mod.rs +++ b/html5ever/src/tokenizer/mod.rs @@ -683,6 +683,7 @@ impl Tokenizer { // Run the state machine for a while. // Return true if we should be immediately re-invoked // (this just simplifies control flow vs. break / continue). + #[allow(clippy::never_loop)] fn step(&mut self, input: &mut BufferQueue) -> ProcessResult { if self.char_ref_tokenizer.is_some() { return self.step_char_ref_tokenizer(input); diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index e2783199..b1a36e1f 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -639,6 +639,7 @@ impl XmlTokenizer { // Run the state machine for a while. // Return true if we should be immediately re-invoked // (this just simplifies control flow vs. break / continue). + #[allow(clippy::never_loop)] fn step(&mut self, input: &mut BufferQueue) -> bool { if self.char_ref_tokenizer.is_some() { return self.step_char_ref_tokenizer(input); From 267e098aa3423f3f2709d2fa5250299754b74844 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 09:43:07 +0100 Subject: [PATCH 03/16] Remove useless conversion to the same type, as suggested by clippy https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion --- html5ever/macros/match_token.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/html5ever/macros/match_token.rs b/html5ever/macros/match_token.rs index 6e68afb2..7d73519c 100644 --- a/html5ever/macros/match_token.rs +++ b/html5ever/macros/match_token.rs @@ -108,7 +108,6 @@ use std::collections::HashSet; use std::fs::File; use std::io::{Read, Write}; use std::path::Path; -use syn; use syn::ext::IdentExt; use syn::fold::Fold; use syn::parse::{Parse, ParseStream, Result}; @@ -254,7 +253,7 @@ impl Parse for MatchToken { pub fn expand_match_token(body: &TokenStream) -> syn::Expr { let match_token = syn::parse2::(body.clone()); let ast = expand_match_token_macro(match_token.unwrap()); - syn::parse2(ast.into()).unwrap() + syn::parse2(ast).unwrap() } fn expand_match_token_macro(match_token: MatchToken) -> TokenStream { From df27630115aae973b6caefb355594b855dc3f937 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 09:49:46 +0100 Subject: [PATCH 04/16] No need to match on references, deref the matched expression instead https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats --- rcdom/lib.rs | 18 +++++++++--------- xml5ever/src/serialize/mod.rs | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rcdom/lib.rs b/rcdom/lib.rs index f35ced40..8cfc7b5f 100644 --- a/rcdom/lib.rs +++ b/rcdom/lib.rs @@ -118,7 +118,7 @@ impl Node { /// Create a new node from its contents pub fn new(data: NodeData) -> Rc { Rc::new(Node { - data: data, + data, parent: Cell::new(None), children: RefCell::new(Vec::new()), }) @@ -280,7 +280,7 @@ impl TreeSink for RcDom { fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> Handle { Node::new(NodeData::ProcessingInstruction { - target: target, + target, contents: data, }) } @@ -467,8 +467,8 @@ impl Serialize for SerializableHandle { while let Some(op) = ops.pop_front() { match op { - SerializeOp::Open(handle) => match &handle.data { - &NodeData::Element { + SerializeOp::Open(handle) => match handle.data { + NodeData::Element { ref name, ref attrs, .. @@ -486,20 +486,20 @@ impl Serialize for SerializableHandle { } }, - &NodeData::Doctype { ref name, .. } => serializer.write_doctype(&name)?, + NodeData::Doctype { ref name, .. } => serializer.write_doctype(&name)?, - &NodeData::Text { ref contents } => { + NodeData::Text { ref contents } => { serializer.write_text(&contents.borrow())? }, - &NodeData::Comment { ref contents } => serializer.write_comment(&contents)?, + NodeData::Comment { ref contents } => serializer.write_comment(&contents)?, - &NodeData::ProcessingInstruction { + NodeData::ProcessingInstruction { ref target, ref contents, } => serializer.write_processing_instruction(target, contents)?, - &NodeData::Document => panic!("Can't serialize Document node itself"), + NodeData::Document => panic!("Can't serialize Document node itself"), }, SerializeOp::Close(name) => { diff --git a/xml5ever/src/serialize/mod.rs b/xml5ever/src/serialize/mod.rs index d4adfca2..182ed9c8 100644 --- a/xml5ever/src/serialize/mod.rs +++ b/xml5ever/src/serialize/mod.rs @@ -156,13 +156,13 @@ impl Serializer for XmlSerializer { if let Some(current_namespace) = self.namespace_stack.0.last() { for (prefix, url_opt) in current_namespace.get_scope_iter() { self.writer.write_all(b" xmlns")?; - if let &Some(ref p) = prefix { + if let Some(ref p) = *prefix { self.writer.write_all(b":")?; self.writer.write_all(&*p.as_bytes())?; } self.writer.write_all(b"=\"")?; - let url = if let &Some(ref a) = url_opt { + let url = if let Some(ref a) = *url_opt { a.as_bytes() } else { b"" From 70753233c2827a174340e19647291720c0a3bc82 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 09:56:51 +0100 Subject: [PATCH 05/16] Fix a warning about unused return value of std::mem::replace Since the old value is not needed, the new value can be assigned directly. --- xml5ever/src/tree_builder/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xml5ever/src/tree_builder/mod.rs b/xml5ever/src/tree_builder/mod.rs index 6913a98f..cc200308 100644 --- a/xml5ever/src/tree_builder/mod.rs +++ b/xml5ever/src/tree_builder/mod.rs @@ -362,7 +362,8 @@ where new_attr.push(attr.clone()); } } - mem::replace(&mut tag.attrs, new_attr); + tag.attrs = new_attr; + // Then we bind the tags namespace. self.bind_qname(&mut tag.name); From 09cc643f0bcfee965f8aca5cd197a3101b170445 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 10:01:00 +0100 Subject: [PATCH 06/16] Use a char instead of a single-character str, as suggested by clippy https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern --- markup5ever/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markup5ever/build.rs b/markup5ever/build.rs index 1f8d5ac4..38b4fddd 100644 --- a/markup5ever/build.rs +++ b/markup5ever/build.rs @@ -87,7 +87,7 @@ fn named_entities_to_phf(to: &Path) { let mut entities: HashMap<&str, (u32, u32)> = entities::NAMED_ENTITIES .iter() .map(|(name, cp1, cp2)| { - assert!(name.starts_with("&")); + assert!(name.starts_with('&')); (&name[1..], (*cp1, *cp2)) }) .collect(); From d8984efeff9eaba3ab52a77a77a1f765c0e77bcc Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 10:07:59 +0100 Subject: [PATCH 07/16] Remove redundant closures as suggested by clippy https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure --- html5ever/src/tokenizer/mod.rs | 4 ++-- xml5ever/src/tokenizer/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/html5ever/src/tokenizer/mod.rs b/html5ever/src/tokenizer/mod.rs index 6f17b429..472bc2e4 100644 --- a/html5ever/src/tokenizer/mod.rs +++ b/html5ever/src/tokenizer/mod.rs @@ -300,13 +300,13 @@ impl Tokenizer { // It shouldn't matter because the fallback `FromSet` case should // always do the same thing as the `NotFromSet` case. if self.opts.exact_errors || self.reconsume || self.ignore_lf { - return self.get_char(input).map(|x| FromSet(x)); + return self.get_char(input).map(FromSet); } let d = input.pop_except_from(set); debug!("got characters {:?}", d); match d { - Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(|x| FromSet(x)), + Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(FromSet), // NB: We don't set self.current_char for a run of characters not // in the set. It shouldn't matter for the codepaths that use diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index b1a36e1f..131dfc86 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -280,13 +280,13 @@ impl XmlTokenizer { // It shouldn't matter because the fallback `FromSet` case should // always do the same thing as the `NotFromSet` case. if self.opts.exact_errors || self.reconsume || self.ignore_lf { - return self.get_char(input).map(|x| FromSet(x)); + return self.get_char(input).map(FromSet); } let d = input.pop_except_from(set); debug!("got characters {:?}", d); match d { - Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(|x| FromSet(x)), + Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(FromSet), // NB: We don't set self.current_char for a run of characters not // in the set. It shouldn't matter for the codepaths that use From d8711d95f91c8b2fedd7b4e4ee37a899fc8f4d38 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 10:18:06 +0100 Subject: [PATCH 08/16] Prefer is_empty() over getting the length and comparing to zero https://rust-lang.github.io/rust-clippy/master/index.html#len_zero --- html5ever/src/serialize/mod.rs | 2 +- html5ever/src/tokenizer/mod.rs | 2 +- html5ever/src/tree_builder/mod.rs | 2 +- xml5ever/src/tokenizer/mod.rs | 2 +- xml5ever/src/tokenizer/qname.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/html5ever/src/serialize/mod.rs b/html5ever/src/serialize/mod.rs index 5c6c156f..10de576d 100644 --- a/html5ever/src/serialize/mod.rs +++ b/html5ever/src/serialize/mod.rs @@ -93,7 +93,7 @@ impl HtmlSerializer { } fn parent(&mut self) -> &mut ElemInfo { - if self.stack.len() == 0 { + if self.stack.is_empty() { if self.opts.create_missing_parent { warn!("ElemInfo stack empty, creating new parent"); self.stack.push(Default::default()); diff --git a/html5ever/src/tokenizer/mod.rs b/html5ever/src/tokenizer/mod.rs index 472bc2e4..1ad3b2df 100644 --- a/html5ever/src/tokenizer/mod.rs +++ b/html5ever/src/tokenizer/mod.rs @@ -495,7 +495,7 @@ impl Tokenizer { } fn finish_attribute(&mut self) { - if self.current_attr_name.len() == 0 { + if self.current_attr_name.is_empty() { return; } diff --git a/html5ever/src/tree_builder/mod.rs b/html5ever/src/tree_builder/mod.rs index a73963c1..a6fa8bf2 100644 --- a/html5ever/src/tree_builder/mod.rs +++ b/html5ever/src/tree_builder/mod.rs @@ -1429,7 +1429,7 @@ where return false; } - if self.open_elems.len() == 0 { + if self.open_elems.is_empty() { return false; } diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index 131dfc86..3b3f2528 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -1226,7 +1226,7 @@ impl XmlTokenizer { } fn finish_attribute(&mut self) { - if self.current_attr_name.len() == 0 { + if self.current_attr_name.is_empty() { return; } diff --git a/xml5ever/src/tokenizer/qname.rs b/xml5ever/src/tokenizer/qname.rs index 249cfb11..a9afab48 100644 --- a/xml5ever/src/tokenizer/qname.rs +++ b/xml5ever/src/tokenizer/qname.rs @@ -31,7 +31,7 @@ impl<'a> QualNameTokenizer<'a> { } pub fn run(&mut self) -> Option { - if self.slice.len() > 0 { + if !self.slice.is_empty() { loop { if !self.step() { break; From 3af60868e642933bb29a5fc0ecdf649530e9b5eb Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 10:26:59 +0100 Subject: [PATCH 09/16] Remove a needless return, as suggested by clippy --- xml5ever/src/tokenizer/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index 3b3f2528..597a602f 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -649,7 +649,7 @@ impl XmlTokenizer { match self.state { XmlState::Quiescent => { self.state = XmlState::Data; - return false; + false }, //ยง data-state XmlState::Data => loop { From 5d41a6c6c83755337a8c0a2ab3146a797217172f Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 10:31:42 +0100 Subject: [PATCH 10/16] Use find(!condition) instead of skip_while(condition).next() https://rust-lang.github.io/rust-clippy/master/index.html#skip_while_next --- markup5ever/util/buffer_queue.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/markup5ever/util/buffer_queue.rs b/markup5ever/util/buffer_queue.rs index e3362adc..5b24a422 100644 --- a/markup5ever/util/buffer_queue.rs +++ b/markup5ever/util/buffer_queue.rs @@ -95,8 +95,7 @@ impl BufferQueue { debug_assert!( self.buffers .iter() - .skip_while(|el| el.len32() != 0) - .next() + .find(|el| el.len32() == 0) .is_none(), "invariant \"all buffers in the queue are non-empty\" failed" ); From daf07b4e004964502be126926276e2ea37747a11 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 12:15:49 +0100 Subject: [PATCH 11/16] Use println!() instead of print!() with a newline https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline --- xml5ever/src/tree_builder/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xml5ever/src/tree_builder/mod.rs b/xml5ever/src/tree_builder/mod.rs index cc200308..b7e69c0b 100644 --- a/xml5ever/src/tree_builder/mod.rs +++ b/xml5ever/src/tree_builder/mod.rs @@ -74,7 +74,7 @@ impl Debug for NamespaceMap { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { write!(f, "\nNamespaceMap[")?; for (key, value) in &self.scope { - write!(f, " {:?} : {:?}\n", key, value)?; + writeln!(f, " {:?} : {:?}", key, value)?; } write!(f, "]") } @@ -386,6 +386,8 @@ where loop { let phase = self.phase; + + #[allow(clippy::unused_unit)] match self.step(phase, token) { Done => { token = unwrap_or_return!(more_tokens.pop_front(), ()); From 032de9f1464a01b2321dda6d7b9710c52256c2a6 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 12:17:25 +0100 Subject: [PATCH 12/16] Suppress clippy warnings about method names that violate conventions Changing these method names would break the public API, so I guess that is not an option. https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention --- html5ever/src/driver.rs | 1 + xml5ever/src/driver.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/html5ever/src/driver.rs b/html5ever/src/driver.rs index 11a7a74d..26db9b8d 100644 --- a/html5ever/src/driver.rs +++ b/html5ever/src/driver.rs @@ -130,6 +130,7 @@ impl Parser { /// /// Use this when your input is bytes that are known to be in the UTF-8 encoding. /// Decoding is lossy, like `String::from_utf8_lossy`. + #[allow(clippy::wrong_self_convention)] pub fn from_utf8(self) -> Utf8LossyDecoder { Utf8LossyDecoder::new(self) } diff --git a/xml5ever/src/driver.rs b/xml5ever/src/driver.rs index 72335dac..df5b9ee4 100644 --- a/xml5ever/src/driver.rs +++ b/xml5ever/src/driver.rs @@ -82,6 +82,7 @@ impl XmlParser { /// /// Use this when your input is bytes that are known to be in the UTF-8 encoding. /// Decoding is lossy, like `String::from_utf8_lossy`. + #[allow(clippy::wrong_self_convention)] pub fn from_utf8(self) -> Utf8LossyDecoder { Utf8LossyDecoder::new(self) } From 10d8c58ffc608da156cfe43e0485cfe0b9827740 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 12:25:43 +0100 Subject: [PATCH 13/16] Apply minor improvements suggested by clippy https://rust-lang.github.io/rust-clippy/master/index.html#question_mark https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg --- markup5ever/util/buffer_queue.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/markup5ever/util/buffer_queue.rs b/markup5ever/util/buffer_queue.rs index 5b24a422..d5724890 100644 --- a/markup5ever/util/buffer_queue.rs +++ b/markup5ever/util/buffer_queue.rs @@ -201,15 +201,14 @@ impl BufferQueue { pub fn eat bool>(&mut self, pat: &str, eq: F) -> Option { let mut buffers_exhausted = 0; let mut consumed_from_last = 0; - if self.buffers.front().is_none() { - return None; - } + + self.buffers.front()?; for pattern_byte in pat.bytes() { if buffers_exhausted >= self.buffers.len() { return None; } - let ref buf = self.buffers[buffers_exhausted]; + let buf = &self.buffers[buffers_exhausted]; if !eq(&buf.as_bytes()[consumed_from_last], &pattern_byte) { return Some(false); From 60159c4d8cfd63ee701a1f47e7107e5c2b35b430 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 21 Jan 2021 13:35:10 +0100 Subject: [PATCH 14/16] Remove unnecessary explicit lifetime specifiers https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes --- html5ever/src/tokenizer/char_ref/mod.rs | 4 ++-- html5ever/src/tokenizer/mod.rs | 2 +- xml5ever/src/tokenizer/char_ref/mod.rs | 4 ++-- xml5ever/src/tokenizer/mod.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/html5ever/src/tokenizer/char_ref/mod.rs b/html5ever/src/tokenizer/char_ref/mod.rs index dd7e5885..a52485d3 100644 --- a/html5ever/src/tokenizer/char_ref/mod.rs +++ b/html5ever/src/tokenizer/char_ref/mod.rs @@ -85,13 +85,13 @@ impl CharRefTokenizer { self.result.expect("get_result called before done") } - fn name_buf<'t>(&'t self) -> &'t StrTendril { + fn name_buf(&self) -> &StrTendril { self.name_buf_opt .as_ref() .expect("name_buf missing in named character reference") } - fn name_buf_mut<'t>(&'t mut self) -> &'t mut StrTendril { + fn name_buf_mut(&mut self) -> &mut StrTendril { self.name_buf_opt .as_mut() .expect("name_buf missing in named character reference") diff --git a/html5ever/src/tokenizer/mod.rs b/html5ever/src/tokenizer/mod.rs index 1ad3b2df..267fdf3e 100644 --- a/html5ever/src/tokenizer/mod.rs +++ b/html5ever/src/tokenizer/mod.rs @@ -530,7 +530,7 @@ impl Tokenizer { self.process_token_and_continue(DoctypeToken(doctype)); } - fn doctype_id<'a>(&'a mut self, kind: DoctypeIdKind) -> &'a mut Option { + fn doctype_id(&mut self, kind: DoctypeIdKind) -> &mut Option { match kind { Public => &mut self.current_doctype.public_id, System => &mut self.current_doctype.system_id, diff --git a/xml5ever/src/tokenizer/char_ref/mod.rs b/xml5ever/src/tokenizer/char_ref/mod.rs index 9106b6c9..a0252935 100644 --- a/xml5ever/src/tokenizer/char_ref/mod.rs +++ b/xml5ever/src/tokenizer/char_ref/mod.rs @@ -84,13 +84,13 @@ impl CharRefTokenizer { self.result.expect("get_result called before done") } - fn name_buf<'t>(&'t self) -> &'t StrTendril { + fn name_buf(&self) -> &StrTendril { self.name_buf_opt .as_ref() .expect("name_buf missing in named character reference") } - fn name_buf_mut<'t>(&'t mut self) -> &'t mut StrTendril { + fn name_buf_mut(&mut self) -> &mut StrTendril { self.name_buf_opt .as_mut() .expect("name_buf missing in named character reference") diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index 597a602f..97b10669 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -482,7 +482,7 @@ impl XmlTokenizer { self.process_token(DoctypeToken(doctype)); } - fn doctype_id<'a>(&'a mut self, kind: DoctypeKind) -> &'a mut Option { + fn doctype_id(&mut self, kind: DoctypeKind) -> &mut Option { match kind { Public => &mut self.current_doctype.public_id, System => &mut self.current_doctype.system_id, From 03076751c31c94ddc8995318ef89f01816a1b324 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 3 Mar 2021 14:55:06 +0100 Subject: [PATCH 15/16] Remove an unnecessary trailing semicolon that broke the build --- xml5ever/src/tree_builder/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml5ever/src/tree_builder/mod.rs b/xml5ever/src/tree_builder/mod.rs index b7e69c0b..708776d0 100644 --- a/xml5ever/src/tree_builder/mod.rs +++ b/xml5ever/src/tree_builder/mod.rs @@ -502,7 +502,7 @@ where Some(expr) => expr, None => Tendril::new(), } - }; + } self.sink.append_doctype_to_document( get_tendril(doctype.name), get_tendril(doctype.public_id), From d1206daa740305f55a5fa159e43eb33afc359cb4 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 3 Mar 2021 14:56:19 +0100 Subject: [PATCH 16/16] Remove a field that was never read This caused the Travis build to fail. --- html5ever/src/serialize/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/html5ever/src/serialize/mod.rs b/html5ever/src/serialize/mod.rs index 10de576d..3a57b477 100644 --- a/html5ever/src/serialize/mod.rs +++ b/html5ever/src/serialize/mod.rs @@ -53,8 +53,7 @@ impl Default for SerializeOpts { #[derive(Default)] struct ElemInfo { html_name: Option, - ignore_children: bool, - processed_first_child: bool, + ignore_children: bool } pub struct HtmlSerializer { @@ -87,7 +86,6 @@ impl HtmlSerializer { stack: vec![ElemInfo { html_name, ignore_children: false, - processed_first_child: false, }], } } @@ -133,7 +131,6 @@ impl Serializer for HtmlSerializer { self.stack.push(ElemInfo { html_name, ignore_children: true, - processed_first_child: false, }); return Ok(()); } @@ -189,12 +186,9 @@ impl Serializer for HtmlSerializer { _ => false, }; - self.parent().processed_first_child = true; - self.stack.push(ElemInfo { html_name, ignore_children, - processed_first_child: false, }); Ok(())