mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-28 15:40:04 +00:00
Merge pull request #2008 from buley/feature/fix-scanner-warnings
chore: fix dead code and error swallowing warnings
This commit is contained in:
@@ -158,13 +158,13 @@ pub extern "C" fn html5ever_attribute_iterator_next(
|
|||||||
|
|
||||||
let attr = &iter.vec[pos];
|
let attr = &iter.vec[pos];
|
||||||
iter.pos += 1;
|
iter.pos += 1;
|
||||||
return CNullable::<CAttribute>::some(CAttribute {
|
CNullable::<CAttribute>::some(CAttribute {
|
||||||
name: CQualName::create(&attr.name),
|
name: CQualName::create(&attr.name),
|
||||||
value: StringSlice {
|
value: StringSlice {
|
||||||
ptr: attr.value.as_ptr(),
|
ptr: attr.value.as_ptr(),
|
||||||
len: attr.value.len(),
|
len: attr.value.len(),
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@@ -186,12 +186,12 @@ pub extern "C" fn html5ever_get_memory_usage() -> Memory {
|
|||||||
use tikv_jemalloc_ctl::{epoch, stats};
|
use tikv_jemalloc_ctl::{epoch, stats};
|
||||||
|
|
||||||
// many statistics are cached and only updated when the epoch is advanced.
|
// many statistics are cached and only updated when the epoch is advanced.
|
||||||
epoch::advance().unwrap();
|
drop(epoch::advance());
|
||||||
|
|
||||||
return Memory {
|
Memory {
|
||||||
resident: stats::resident::read().unwrap(),
|
resident: stats::resident::read().unwrap_or(0),
|
||||||
allocated: stats::allocated::read().unwrap(),
|
allocated: stats::allocated::read().unwrap_or(0),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Streaming parser API
|
// 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
|
// Drop the parser box without finishing
|
||||||
// This is for cases where you want to cancel parsing
|
// This is for cases where you want to cancel parsing
|
||||||
unsafe {
|
unsafe {
|
||||||
let _ = Box::from_raw(parser_ptr as *mut StreamingParser);
|
drop(Box::from_raw(parser_ptr as *mut StreamingParser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ pub struct ElementData {
|
|||||||
}
|
}
|
||||||
impl ElementData {
|
impl ElementData {
|
||||||
fn new(qname: QualName, flags: ElementFlags) -> Self {
|
fn new(qname: QualName, flags: ElementFlags) -> Self {
|
||||||
return Self {
|
Self {
|
||||||
qname: qname,
|
qname: qname,
|
||||||
mathml_annotation_xml_integration_point: flags.mathml_annotation_xml_integration_point,
|
mathml_annotation_xml_integration_point: flags.mathml_annotation_xml_integration_point,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,12 +130,12 @@ impl<'arena> TreeSink for Sink<'arena> {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let mut attribute_iterator = CAttributeIterator { vec: attrs, pos: 0 };
|
let mut attribute_iterator = CAttributeIterator { vec: attrs, pos: 0 };
|
||||||
|
|
||||||
return (self.create_element_callback)(
|
(self.create_element_callback)(
|
||||||
self.ctx,
|
self.ctx,
|
||||||
data as *mut _ as *mut c_void,
|
data as *mut _ as *mut c_void,
|
||||||
CQualName::create(&name),
|
CQualName::create(&name),
|
||||||
&mut attribute_iterator as *mut _ as *mut c_void,
|
&mut attribute_iterator as *mut _ as *mut c_void,
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,21 +126,21 @@ impl CQualName {
|
|||||||
None => CNullable::<StringSlice>::none(),
|
None => CNullable::<StringSlice>::none(),
|
||||||
Some(prefix) => CNullable::<StringSlice>::some(StringSlice { ptr: prefix.as_ptr(), len: prefix.len()}),
|
Some(prefix) => CNullable::<StringSlice>::some(StringSlice { ptr: prefix.as_ptr(), len: prefix.len()}),
|
||||||
};
|
};
|
||||||
return CQualName{
|
CQualName{
|
||||||
// inner: q as *const _ as *const c_void,
|
// inner: q as *const _ as *const c_void,
|
||||||
ns: ns,
|
ns: ns,
|
||||||
local: local,
|
local: local,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Default for CQualName {
|
impl Default for CQualName {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
return Self{
|
Self{
|
||||||
prefix: CNullable::<StringSlice>::none(),
|
prefix: CNullable::<StringSlice>::none(),
|
||||||
ns: StringSlice::default(),
|
ns: StringSlice::default(),
|
||||||
local: StringSlice::default(),
|
local: StringSlice::default(),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user