mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy:Fix clippy problems in components/scripts/binding (#31893)
* constants have by default a static lifetime * constants have by default a static lifetime * unneeded unit expression * unneeded unit expression * Box of default value * casting raw pointers * casting raw pointers
This commit is contained in:
parent
1f31609952
commit
bb7778774d
7 changed files with 12 additions and 16 deletions
|
@ -124,7 +124,7 @@ where
|
|||
{
|
||||
pub fn default() -> HeapBufferSource<T> {
|
||||
HeapBufferSource {
|
||||
buffer_source: BufferSource::Default(Box::new(Heap::default())),
|
||||
buffer_source: BufferSource::Default(Box::default()),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ pub trait CallbackContainer {
|
|||
///
|
||||
/// ["callback context"]: https://heycam.github.io/webidl/#dfn-callback-context
|
||||
fn incumbent(&self) -> Option<&GlobalScope> {
|
||||
self.callback_holder().incumbent.as_ref().map(Dom::deref)
|
||||
self.callback_holder().incumbent.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ impl FromJSValConvertible for USVString {
|
|||
let mut length = 0;
|
||||
let chars = JS_GetTwoByteStringCharsAndLength(cx, ptr::null(), jsstr, &mut length);
|
||||
assert!(!chars.is_null());
|
||||
let char_vec = slice::from_raw_parts(chars as *const u16, length);
|
||||
let char_vec = slice::from_raw_parts(chars, length);
|
||||
Ok(ConversionResult::Success(USVString(
|
||||
String::from_utf16_lossy(char_vec),
|
||||
)))
|
||||
|
@ -395,7 +395,7 @@ pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<&'static DOMClass, ()>
|
|||
if is_dom_class(&*clasp) {
|
||||
trace!("plain old dom object");
|
||||
let domjsclass: *const DOMJSClass = clasp as *const DOMJSClass;
|
||||
return Ok(&(&*domjsclass).dom_class);
|
||||
return Ok(&(*domjsclass).dom_class);
|
||||
}
|
||||
if is_dom_proxy(obj) {
|
||||
trace!("proxy dom object");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue