diff --git a/src/html5ever/lib.rs b/src/html5ever/lib.rs
index 59ef6890..29d62539 100644
--- a/src/html5ever/lib.rs
+++ b/src/html5ever/lib.rs
@@ -158,13 +158,13 @@ pub extern "C" fn html5ever_attribute_iterator_next(
let attr = &iter.vec[pos];
iter.pos += 1;
- return CNullable::::some(CAttribute {
+ CNullable::::some(CAttribute {
name: CQualName::create(&attr.name),
value: StringSlice {
ptr: attr.value.as_ptr(),
len: attr.value.len(),
},
- });
+ })
}
#[no_mangle]
@@ -186,12 +186,12 @@ pub extern "C" fn html5ever_get_memory_usage() -> Memory {
use tikv_jemalloc_ctl::{epoch, stats};
// many statistics are cached and only updated when the epoch is advanced.
- epoch::advance().unwrap();
+ drop(epoch::advance());
- return Memory {
- resident: stats::resident::read().unwrap(),
- allocated: stats::allocated::read().unwrap(),
- };
+ Memory {
+ resident: stats::resident::read().unwrap_or(0),
+ allocated: stats::allocated::read().unwrap_or(0),
+ }
}
// Streaming parser API
@@ -325,7 +325,7 @@ pub extern "C" fn html5ever_streaming_parser_destroy(parser_ptr: *mut c_void) {
// Drop the parser box without finishing
// This is for cases where you want to cancel parsing
unsafe {
- let _ = Box::from_raw(parser_ptr as *mut StreamingParser);
+ drop(Box::from_raw(parser_ptr as *mut StreamingParser));
}
}
diff --git a/src/html5ever/sink.rs b/src/html5ever/sink.rs
index 24a36656..371fd260 100644
--- a/src/html5ever/sink.rs
+++ b/src/html5ever/sink.rs
@@ -36,10 +36,10 @@ pub struct ElementData {
}
impl ElementData {
fn new(qname: QualName, flags: ElementFlags) -> Self {
- return Self {
+ Self {
qname: qname,
mathml_annotation_xml_integration_point: flags.mathml_annotation_xml_integration_point,
- };
+ }
}
}
@@ -130,12 +130,12 @@ impl<'arena> TreeSink for Sink<'arena> {
unsafe {
let mut attribute_iterator = CAttributeIterator { vec: attrs, pos: 0 };
- return (self.create_element_callback)(
+ (self.create_element_callback)(
self.ctx,
data as *mut _ as *mut c_void,
CQualName::create(&name),
&mut attribute_iterator as *mut _ as *mut c_void,
- );
+ )
}
}
diff --git a/src/html5ever/types.rs b/src/html5ever/types.rs
index b49cdd9a..48ed9c3e 100644
--- a/src/html5ever/types.rs
+++ b/src/html5ever/types.rs
@@ -126,21 +126,21 @@ impl CQualName {
None => CNullable::::none(),
Some(prefix) => CNullable::::some(StringSlice { ptr: prefix.as_ptr(), len: prefix.len()}),
};
- return CQualName{
+ CQualName{
// inner: q as *const _ as *const c_void,
ns: ns,
local: local,
prefix: prefix,
- };
+ }
}
}
impl Default for CQualName {
fn default() -> Self {
- return Self{
+ Self{
prefix: CNullable::::none(),
ns: StringSlice::default(),
local: StringSlice::default(),
- };
+ }
}
}