mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #7536 - Manishearth:clippyfix, r=Ms2ger
More clippy fixes Elided almost all the lifetimes and removed needless returns. Mostly done by sed + manual fixes. r? @nox <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7536) <!-- Reviewable:end -->
This commit is contained in:
commit
c2c2646d37
53 changed files with 279 additions and 289 deletions
|
@ -14,7 +14,7 @@ use std::borrow::ToOwned;
|
|||
|
||||
/// Trait for elements with defined activation behavior
|
||||
pub trait Activatable {
|
||||
fn as_element<'a>(&'a self) -> &'a Element;
|
||||
fn as_element(&self) -> ∈
|
||||
|
||||
// Is this particular instance of the element activatable?
|
||||
fn is_instance_activatable(&self) -> bool;
|
||||
|
|
|
@ -75,14 +75,14 @@ impl AttrValue {
|
|||
AttrValue::Atom(value)
|
||||
}
|
||||
|
||||
pub fn as_tokens<'a>(&'a self) -> &'a [Atom] {
|
||||
pub fn as_tokens(&self) -> &[Atom] {
|
||||
match *self {
|
||||
AttrValue::TokenList(_, ref tokens) => tokens,
|
||||
_ => panic!("Tokens not found"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_atom<'a>(&'a self) -> &'a Atom {
|
||||
pub fn as_atom(&self) -> &Atom {
|
||||
match *self {
|
||||
AttrValue::Atom(ref value) => value,
|
||||
_ => panic!("Atom not found"),
|
||||
|
@ -104,7 +104,7 @@ impl AttrValue {
|
|||
impl Deref for AttrValue {
|
||||
type Target = str;
|
||||
|
||||
fn deref<'a>(&'a self) -> &'a str {
|
||||
fn deref(&self) -> &str {
|
||||
match *self {
|
||||
AttrValue::String(ref value) |
|
||||
AttrValue::TokenList(ref value, _) |
|
||||
|
@ -152,17 +152,17 @@ impl Attr {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn name<'a>(&'a self) -> &'a Atom {
|
||||
pub fn name(&self) -> &Atom {
|
||||
&self.name
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn namespace<'a>(&'a self) -> &'a Namespace {
|
||||
pub fn namespace(&self) -> &Namespace {
|
||||
&self.namespace
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn prefix<'a>(&'a self) -> &'a Option<Atom> {
|
||||
pub fn prefix(&self) -> &Option<Atom> {
|
||||
&self.prefix
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<T> DOMRefCell<T> {
|
|||
///
|
||||
/// For use in the layout task only.
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn borrow_for_layout<'a>(&'a self) -> &'a T {
|
||||
pub unsafe fn borrow_for_layout(&self) -> &T {
|
||||
debug_assert!(task_state::get().is_layout());
|
||||
&*self.value.as_unsafe_cell().get()
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// This succeeds even if the object is mutably borrowed,
|
||||
/// so you have to be careful in trace code!
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T {
|
||||
pub unsafe fn borrow_for_gc_trace(&self) -> &T {
|
||||
// FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs
|
||||
// https://github.com/servo/servo/issues/6389
|
||||
//debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
|
||||
|
@ -49,7 +49,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// Borrow the contents for the purpose of script deallocation.
|
||||
///
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T {
|
||||
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
|
||||
debug_assert!(task_state::get().contains(SCRIPT));
|
||||
&mut *self.value.as_unsafe_cell().get()
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if this is called off the script thread.
|
||||
pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> {
|
||||
pub fn try_borrow(&self) -> Option<Ref<T>> {
|
||||
debug_assert!(task_state::get().is_script());
|
||||
match self.value.borrow_state() {
|
||||
BorrowState::Writing => None,
|
||||
|
@ -89,7 +89,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if this is called off the script thread.
|
||||
pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
|
||||
pub fn try_borrow_mut(&self) -> Option<RefMut<T>> {
|
||||
debug_assert!(task_state::get().is_script());
|
||||
match self.value.borrow_state() {
|
||||
BorrowState::Unused => Some(self.value.borrow_mut()),
|
||||
|
@ -127,7 +127,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// Panics if this is called off the script thread.
|
||||
///
|
||||
/// Panics if the value is currently mutably borrowed.
|
||||
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
|
||||
pub fn borrow(&self) -> Ref<T> {
|
||||
self.try_borrow().expect("DOMRefCell<T> already mutably borrowed")
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// Panics if this is called off the script thread.
|
||||
///
|
||||
/// Panics if the value is currently borrowed.
|
||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
|
||||
pub fn borrow_mut(&self) -> RefMut<T> {
|
||||
self.try_borrow_mut().expect("DOMRefCell<T> already borrowed")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ unsafe fn get_dom_class(obj: *mut JSObject) -> Result<DOMClass, ()> {
|
|||
return Ok(*dom_class);
|
||||
}
|
||||
debug!("not a dom object");
|
||||
return Err(());
|
||||
Err(())
|
||||
}
|
||||
|
||||
/// Get a `*const libc::c_void` for the given DOM object, unwrapping any
|
||||
|
|
|
@ -204,7 +204,7 @@ impl<'a> Reflectable for GlobalRef<'a> {
|
|||
impl GlobalRoot {
|
||||
/// Obtain a safe reference to the global object that cannot outlive the
|
||||
/// lifetime of this root.
|
||||
pub fn r<'c>(&'c self) -> GlobalRef<'c> {
|
||||
pub fn r(&self) -> GlobalRef {
|
||||
match *self {
|
||||
GlobalRoot::Window(ref window) => GlobalRef::Window(window.r()),
|
||||
GlobalRoot::Worker(ref worker) => GlobalRef::Worker(worker.r()),
|
||||
|
|
|
@ -149,7 +149,7 @@ impl LayoutJS<Node> {
|
|||
}
|
||||
|
||||
impl<T: Reflectable> Reflectable for JS<T> {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
fn reflector(&self) -> &Reflector {
|
||||
unsafe {
|
||||
(**self.ptr).reflector()
|
||||
}
|
||||
|
@ -310,11 +310,11 @@ impl<T: Reflectable> LayoutJS<T> {
|
|||
pub trait RootedReference<T> {
|
||||
/// Obtain a safe optional reference to the wrapped JS owned-value that
|
||||
/// cannot outlive the lifetime of this root.
|
||||
fn r<'a>(&'a self) -> Option<&'a T>;
|
||||
fn r(&self) -> Option<&T>;
|
||||
}
|
||||
|
||||
impl<T: Reflectable> RootedReference<T> for Option<Root<T>> {
|
||||
fn r<'a>(&'a self) -> Option<&'a T> {
|
||||
fn r(&self) -> Option<&T> {
|
||||
self.as_ref().map(|root| root.r())
|
||||
}
|
||||
}
|
||||
|
@ -323,11 +323,11 @@ impl<T: Reflectable> RootedReference<T> for Option<Root<T>> {
|
|||
pub trait OptionalRootedReference<T> {
|
||||
/// Obtain a safe optional optional reference to the wrapped JS owned-value
|
||||
/// that cannot outlive the lifetime of this root.
|
||||
fn r<'a>(&'a self) -> Option<Option<&'a T>>;
|
||||
fn r(&self) -> Option<Option<&T>>;
|
||||
}
|
||||
|
||||
impl<T: Reflectable> OptionalRootedReference<T> for Option<Option<Root<T>>> {
|
||||
fn r<'a>(&'a self) -> Option<Option<&'a T>> {
|
||||
fn r(&self) -> Option<Option<&T>> {
|
||||
self.as_ref().map(|inner| inner.r())
|
||||
}
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ impl<T: Reflectable> Root<T> {
|
|||
|
||||
/// Obtain a safe reference to the wrapped JS owned-value that cannot
|
||||
/// outlive the lifetime of this root.
|
||||
pub fn r<'a>(&'a self) -> &'a T {
|
||||
pub fn r(&self) -> &T {
|
||||
&**self
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ impl<T: Reflectable> Root<T> {
|
|||
|
||||
impl<T: Reflectable> Deref for Root<T> {
|
||||
type Target = T;
|
||||
fn deref<'a>(&'a self) -> &'a T {
|
||||
fn deref(&self) -> &T {
|
||||
unsafe { &**self.ptr.deref() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,14 +87,14 @@ pub unsafe extern fn prevent_extensions(_cx: *mut JSContext,
|
|||
_proxy: HandleObject,
|
||||
result: *mut ObjectOpResult) -> u8 {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as u32;
|
||||
return JSTrue;
|
||||
JSTrue
|
||||
}
|
||||
|
||||
/// Reports whether the object is Extensible
|
||||
pub unsafe extern fn is_extensible(_cx: *mut JSContext, _proxy: HandleObject,
|
||||
succeeded: *mut u8) -> u8 {
|
||||
*succeeded = JSTrue;
|
||||
return JSTrue;
|
||||
JSTrue
|
||||
}
|
||||
|
||||
/// Get the expando object, or null if there is none.
|
||||
|
@ -123,7 +123,7 @@ pub fn ensure_expando_object(cx: *mut JSContext, obj: HandleObject)
|
|||
|
||||
SetProxyExtra(obj.get(), JSPROXYSLOT_EXPANDO, ObjectValue(&*expando));
|
||||
}
|
||||
return expando;
|
||||
expando
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ impl ByteString {
|
|||
|
||||
/// Returns `self` as a string, if it encodes valid UTF-8, and `None`
|
||||
/// otherwise.
|
||||
pub fn as_str<'a>(&'a self) -> Option<&'a str> {
|
||||
pub fn as_str(&self) -> Option<&str> {
|
||||
let ByteString(ref vec) = *self;
|
||||
str::from_utf8(&vec).ok()
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ fn create_interface_prototype_object(cx: *mut JSContext, global: HandleObject,
|
|||
pub unsafe extern fn throwing_constructor(cx: *mut JSContext, _argc: c_uint,
|
||||
_vp: *mut JSVal) -> u8 {
|
||||
throw_type_error(cx, "Illegal constructor.");
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
/// An array of *mut JSObject of size PrototypeList::ID::Count
|
||||
|
@ -404,7 +404,7 @@ pub fn initialize_global(global: *mut JSObject) {
|
|||
/// A trait to provide access to the `Reflector` for a DOM object.
|
||||
pub trait Reflectable {
|
||||
/// Returns the receiver's reflector.
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector;
|
||||
fn reflector(&self) -> &Reflector;
|
||||
/// Initializes the Reflector
|
||||
fn init_reflector(&mut self, _obj: *mut JSObject) {
|
||||
panic!("Cannot call init on this Reflectable");
|
||||
|
@ -507,7 +507,7 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Option<u32>
|
|||
if RUST_JSID_IS_INT(id) != 0 {
|
||||
return Some(RUST_JSID_TO_INT(id) as u32);
|
||||
}
|
||||
return None;
|
||||
None
|
||||
}
|
||||
// if id is length atom, -1, otherwise
|
||||
/*return if JSID_IS_ATOM(id) {
|
||||
|
@ -559,7 +559,7 @@ pub fn is_platform_object(obj: *mut JSObject) -> bool {
|
|||
clasp = js::jsapi::JS_GetClass(obj);
|
||||
}
|
||||
// TODO also check if JS_IsArrayBufferObject
|
||||
return is_dom_class(&*clasp);
|
||||
is_dom_class(&*clasp)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,8 +631,8 @@ pub fn has_property_on_prototype(cx: *mut JSContext, proxy: HandleObject,
|
|||
id: HandleId) -> bool {
|
||||
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
|
||||
let mut found = false;
|
||||
return !get_property_on_prototype(cx, proxy, id, &mut found,
|
||||
MutableHandleValue { ptr: ptr::null_mut() }) || found;
|
||||
!get_property_on_prototype(cx, proxy, id, &mut found,
|
||||
MutableHandleValue { ptr: ptr::null_mut() }) || found
|
||||
}
|
||||
|
||||
/// Create a DOM global object with the given class.
|
||||
|
@ -812,11 +812,11 @@ pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
|
|||
match xml_name_type(qualified_name) {
|
||||
XMLName::InvalidXMLName => {
|
||||
// Step 1.
|
||||
return Err(Error::InvalidCharacter);
|
||||
Err(Error::InvalidCharacter)
|
||||
},
|
||||
XMLName::Name => {
|
||||
// Step 2.
|
||||
return Err(Error::Namespace);
|
||||
Err(Error::Namespace)
|
||||
},
|
||||
XMLName::QName => Ok(())
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ pub struct Blob {
|
|||
fn is_ascii_printable(string: &DOMString) -> bool {
|
||||
// Step 5.1 in Sec 5.1 of File API spec
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
||||
return string.chars().all(|c| { c >= '\x20' && c <= '\x7E' })
|
||||
string.chars().all(|c| { c >= '\x20' && c <= '\x7E' })
|
||||
}
|
||||
|
||||
impl Blob {
|
||||
|
|
|
@ -177,7 +177,7 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: HandleObject, id: HandleId, b
|
|||
}
|
||||
|
||||
*bp = (found != 0) as u8;
|
||||
return JSTrue;
|
||||
JSTrue
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
@ -179,13 +179,13 @@ impl CharacterData {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
pub trait LayoutCharacterDataHelpers {
|
||||
unsafe fn data_for_layout<'a>(&'a self) -> &'a str;
|
||||
unsafe fn data_for_layout(&self) -> &str;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl LayoutCharacterDataHelpers for LayoutJS<CharacterData> {
|
||||
#[inline]
|
||||
unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
|
||||
unsafe fn data_for_layout(&self) -> &str {
|
||||
&(*self.unsafe_get()).data.borrow_for_layout()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ pub struct SendableWorkerScriptChan {
|
|||
|
||||
impl ScriptChan for SendableWorkerScriptChan {
|
||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
||||
return self.sender.send((self.worker.clone(), msg)).map_err(|_| ());
|
||||
self.sender.send((self.worker.clone(), msg)).map_err(|_| ())
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||
|
@ -84,9 +84,9 @@ pub struct WorkerThreadWorkerChan {
|
|||
|
||||
impl ScriptChan for WorkerThreadWorkerChan {
|
||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
||||
return self.sender
|
||||
self.sender
|
||||
.send((self.worker.clone(), WorkerScriptMsg::Common(msg)))
|
||||
.map_err(|_| ());
|
||||
.map_err(|_| ())
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||
|
|
|
@ -58,17 +58,17 @@ impl DocumentType {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn name<'a>(&'a self) -> &'a DOMString {
|
||||
pub fn name(&self) -> &DOMString {
|
||||
&self.name
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn public_id<'a>(&'a self) -> &'a DOMString {
|
||||
pub fn public_id(&self) -> &DOMString {
|
||||
&self.public_id
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn system_id<'a>(&'a self) -> &'a DOMString {
|
||||
pub fn system_id(&self) -> &DOMString {
|
||||
&self.system_id
|
||||
}
|
||||
}
|
||||
|
|
|
@ -494,8 +494,8 @@ pub trait LayoutElementHelpers {
|
|||
#[allow(unsafe_code)]
|
||||
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
||||
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>;
|
||||
fn local_name<'a>(&'a self) -> &'a Atom;
|
||||
fn namespace<'a>(&'a self) -> &'a Namespace;
|
||||
fn local_name(&self) -> &Atom;
|
||||
fn namespace(&self) -> &Namespace;
|
||||
fn get_checked_state_for_layout(&self) -> bool;
|
||||
fn get_indeterminate_state_for_layout(&self) -> bool;
|
||||
}
|
||||
|
@ -524,14 +524,14 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn local_name<'a>(&'a self) -> &'a Atom {
|
||||
fn local_name(&self) -> &Atom {
|
||||
unsafe {
|
||||
&(*self.unsafe_get()).local_name
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn namespace<'a>(&'a self) -> &'a Namespace {
|
||||
fn namespace(&self) -> &Namespace {
|
||||
unsafe {
|
||||
&(*self.unsafe_get()).namespace
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ impl Event {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_id<'a>(&'a self) -> &'a EventTypeId {
|
||||
pub fn type_id(&self) -> &EventTypeId {
|
||||
&self.type_id
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,8 @@ use dom::node::Node;
|
|||
use dom::virtualmethods::vtable_for;
|
||||
|
||||
// See https://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm
|
||||
pub fn dispatch_event<'a, 'b>(target: &'a EventTarget,
|
||||
pseudo_target: Option<&'b EventTarget>,
|
||||
event: &Event) -> bool {
|
||||
pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>,
|
||||
event: &Event) -> bool {
|
||||
assert!(!event.dispatching());
|
||||
assert!(event.initialized());
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId {
|
||||
pub fn type_id(&self) -> &EventTargetTypeId {
|
||||
&self.type_id
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ impl File {
|
|||
FileBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn name<'a>(&'a self) -> &'a DOMString {
|
||||
pub fn name(&self) -> &DOMString {
|
||||
&self.name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,9 +356,8 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&str>)
|
|||
do_broadcast(doc_node, broadcaster, owner.r(), group)
|
||||
}
|
||||
|
||||
fn in_same_group<'a,'b>(other: &'a HTMLInputElement,
|
||||
owner: Option<&'b HTMLFormElement>,
|
||||
group: Option<&str>) -> bool {
|
||||
fn in_same_group(other: &HTMLInputElement, owner: Option<&HTMLFormElement>,
|
||||
group: Option<&str>) -> bool {
|
||||
let other_owner = other.form_owner();
|
||||
let other_owner = other_owner.r();
|
||||
other.input_type.get() == InputType::InputRadio &&
|
||||
|
|
|
@ -36,7 +36,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement {
|
||||
pub fn htmlelement(&self) -> &HTMLElement {
|
||||
&self.htmlelement
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ impl KeyboardEvent {
|
|||
if self.meta.get() {
|
||||
result = result | constellation_msg::SUPER;
|
||||
}
|
||||
return result;
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -881,7 +881,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
},
|
||||
|
||||
_ => return self.webgl_error(InvalidEnum),
|
||||
_ => self.webgl_error(InvalidEnum),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -899,7 +899,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
},
|
||||
|
||||
_ => return self.webgl_error(InvalidEnum),
|
||||
_ => self.webgl_error(InvalidEnum),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,10 @@ impl WebGLTexture {
|
|||
self.renderer
|
||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||
.unwrap();
|
||||
return Ok(());
|
||||
Ok(())
|
||||
},
|
||||
|
||||
_ => return Err(WebGLError::InvalidEnum),
|
||||
_ => Err(WebGLError::InvalidEnum),
|
||||
}
|
||||
},
|
||||
constants::TEXTURE_MAG_FILTER => {
|
||||
|
@ -120,10 +120,10 @@ impl WebGLTexture {
|
|||
self.renderer
|
||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||
.unwrap();
|
||||
return Ok(());
|
||||
Ok(())
|
||||
},
|
||||
|
||||
_ => return Err(WebGLError::InvalidEnum),
|
||||
_ => Err(WebGLError::InvalidEnum),
|
||||
}
|
||||
},
|
||||
constants::TEXTURE_WRAP_S |
|
||||
|
@ -135,14 +135,14 @@ impl WebGLTexture {
|
|||
self.renderer
|
||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||
.unwrap();
|
||||
return Ok(());
|
||||
Ok(())
|
||||
},
|
||||
|
||||
_ => return Err(WebGLError::InvalidEnum),
|
||||
_ => Err(WebGLError::InvalidEnum),
|
||||
}
|
||||
},
|
||||
|
||||
_ => return Err(WebGLError::InvalidEnum),
|
||||
_ => Err(WebGLError::InvalidEnum),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ pub struct MainThreadScriptChan(pub Sender<MainThreadScriptMsg>);
|
|||
impl ScriptChan for MainThreadScriptChan {
|
||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
||||
let MainThreadScriptChan(ref chan) = *self;
|
||||
return chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ());
|
||||
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue