mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Remove needless returns
This commit is contained in:
parent
2e02ea38fc
commit
e94df1ed5c
14 changed files with 38 additions and 38 deletions
|
@ -178,7 +178,7 @@ impl Font {
|
||||||
status, tag.tag_to_str(),
|
status, tag.tag_to_str(),
|
||||||
self.handle.family_name(), self.handle.face_name());
|
self.handle.family_name(), self.handle.face_name());
|
||||||
|
|
||||||
return result;
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -378,7 +378,7 @@ impl<'a> PaintContext<'a> {
|
||||||
if discriminant == 0. {
|
if discriminant == 0. {
|
||||||
return (Some(x1), None);
|
return (Some(x1), None);
|
||||||
}
|
}
|
||||||
return (Some(x1), Some(x2));
|
(Some(x1), Some(x2))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intersect_ellipse_line(e: Ellipse, l: Line) -> (Option<Point2D<f32>>, Option<Point2D<f32>>) {
|
fn intersect_ellipse_line(e: Ellipse, l: Line) -> (Option<Point2D<f32>>, Option<Point2D<f32>>) {
|
||||||
|
@ -1013,16 +1013,16 @@ impl<'a> PaintContext<'a> {
|
||||||
let left_top = Point2D::new(rect.origin.x, rect.origin.y);
|
let left_top = Point2D::new(rect.origin.x, rect.origin.y);
|
||||||
let scaled_left_top = left_top + Point2D::new(scaled_border.left,
|
let scaled_left_top = left_top + Point2D::new(scaled_border.left,
|
||||||
scaled_border.top);
|
scaled_border.top);
|
||||||
return Rect::new(scaled_left_top,
|
Rect::new(scaled_left_top,
|
||||||
Size2D::new(rect.size.width - 2.0 * scaled_border.right,
|
Size2D::new(rect.size.width - 2.0 * scaled_border.right,
|
||||||
rect.size.height - 2.0 * scaled_border.bottom));
|
rect.size.height - 2.0 * scaled_border.bottom))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
|
fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
|
||||||
return color::new(color.r * scale_factor,
|
color::new(color.r * scale_factor,
|
||||||
color.g * scale_factor,
|
color.g * scale_factor,
|
||||||
color.b * scale_factor,
|
color.b * scale_factor,
|
||||||
color.a);
|
color.a)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_double_border_segment(&self,
|
fn draw_double_border_segment(&self,
|
||||||
|
|
|
@ -164,7 +164,7 @@ impl<'a> TextRun {
|
||||||
glyphs: Arc::new(glyphs),
|
glyphs: Arc::new(glyphs),
|
||||||
bidi_level: bidi_level,
|
bidi_level: bidi_level,
|
||||||
};
|
};
|
||||||
return run;
|
run
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn break_and_shape(font: &mut Font, text: &str, options: &ShapingOptions)
|
pub fn break_and_shape(font: &mut Font, text: &str, options: &ShapingOptions)
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl<'a> PartialEq for ApplicableDeclarationsCacheQuery<'a> {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'a> Eq for ApplicableDeclarationsCacheQuery<'a> {}
|
impl<'a> Eq for ApplicableDeclarationsCacheQuery<'a> {}
|
||||||
|
|
|
@ -661,7 +661,7 @@ unsafe fn get_dom_class(obj: *mut JSObject) -> Result<DOMClass, ()> {
|
||||||
return Ok(*dom_class);
|
return Ok(*dom_class);
|
||||||
}
|
}
|
||||||
debug!("not a dom object");
|
debug!("not a dom object");
|
||||||
return Err(());
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a `*const libc::c_void` for the given DOM object, unwrapping any
|
/// Get a `*const libc::c_void` for the given DOM object, unwrapping any
|
||||||
|
|
|
@ -87,14 +87,14 @@ pub unsafe extern fn prevent_extensions(_cx: *mut JSContext,
|
||||||
_proxy: HandleObject,
|
_proxy: HandleObject,
|
||||||
result: *mut ObjectOpResult) -> u8 {
|
result: *mut ObjectOpResult) -> u8 {
|
||||||
(*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as u32;
|
(*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as u32;
|
||||||
return JSTrue;
|
JSTrue
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reports whether the object is Extensible
|
/// Reports whether the object is Extensible
|
||||||
pub unsafe extern fn is_extensible(_cx: *mut JSContext, _proxy: HandleObject,
|
pub unsafe extern fn is_extensible(_cx: *mut JSContext, _proxy: HandleObject,
|
||||||
succeeded: *mut u8) -> u8 {
|
succeeded: *mut u8) -> u8 {
|
||||||
*succeeded = JSTrue;
|
*succeeded = JSTrue;
|
||||||
return JSTrue;
|
JSTrue
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the expando object, or null if there is none.
|
/// 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));
|
SetProxyExtra(obj.get(), JSPROXYSLOT_EXPANDO, ObjectValue(&*expando));
|
||||||
}
|
}
|
||||||
return expando;
|
expando
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
pub unsafe extern fn throwing_constructor(cx: *mut JSContext, _argc: c_uint,
|
||||||
_vp: *mut JSVal) -> u8 {
|
_vp: *mut JSVal) -> u8 {
|
||||||
throw_type_error(cx, "Illegal constructor.");
|
throw_type_error(cx, "Illegal constructor.");
|
||||||
return 0;
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An array of *mut JSObject of size PrototypeList::ID::Count
|
/// An array of *mut JSObject of size PrototypeList::ID::Count
|
||||||
|
@ -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 {
|
if RUST_JSID_IS_INT(id) != 0 {
|
||||||
return Some(RUST_JSID_TO_INT(id) as u32);
|
return Some(RUST_JSID_TO_INT(id) as u32);
|
||||||
}
|
}
|
||||||
return None;
|
None
|
||||||
}
|
}
|
||||||
// if id is length atom, -1, otherwise
|
// if id is length atom, -1, otherwise
|
||||||
/*return if JSID_IS_ATOM(id) {
|
/*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);
|
clasp = js::jsapi::JS_GetClass(obj);
|
||||||
}
|
}
|
||||||
// TODO also check if JS_IsArrayBufferObject
|
// 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 {
|
id: HandleId) -> bool {
|
||||||
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
|
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
|
||||||
let mut found = false;
|
let mut found = false;
|
||||||
return !get_property_on_prototype(cx, proxy, id, &mut found,
|
!get_property_on_prototype(cx, proxy, id, &mut found,
|
||||||
MutableHandleValue { ptr: ptr::null_mut() }) || found;
|
MutableHandleValue { ptr: ptr::null_mut() }) || found
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a DOM global object with the given class.
|
/// 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) {
|
match xml_name_type(qualified_name) {
|
||||||
XMLName::InvalidXMLName => {
|
XMLName::InvalidXMLName => {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
return Err(Error::InvalidCharacter);
|
Err(Error::InvalidCharacter)
|
||||||
},
|
},
|
||||||
XMLName::Name => {
|
XMLName::Name => {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
return Err(Error::Namespace);
|
Err(Error::Namespace)
|
||||||
},
|
},
|
||||||
XMLName::QName => Ok(())
|
XMLName::QName => Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub struct Blob {
|
||||||
fn is_ascii_printable(string: &DOMString) -> bool {
|
fn is_ascii_printable(string: &DOMString) -> bool {
|
||||||
// Step 5.1 in Sec 5.1 of File API spec
|
// Step 5.1 in Sec 5.1 of File API spec
|
||||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
// 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 {
|
impl Blob {
|
||||||
|
|
|
@ -177,7 +177,7 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: HandleObject, id: HandleId, b
|
||||||
}
|
}
|
||||||
|
|
||||||
*bp = (found != 0) as u8;
|
*bp = (found != 0) as u8;
|
||||||
return JSTrue;
|
JSTrue
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -62,7 +62,7 @@ pub struct SendableWorkerScriptChan {
|
||||||
|
|
||||||
impl ScriptChan for SendableWorkerScriptChan {
|
impl ScriptChan for SendableWorkerScriptChan {
|
||||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
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> {
|
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||||
|
@ -84,9 +84,9 @@ pub struct WorkerThreadWorkerChan {
|
||||||
|
|
||||||
impl ScriptChan for WorkerThreadWorkerChan {
|
impl ScriptChan for WorkerThreadWorkerChan {
|
||||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
||||||
return self.sender
|
self.sender
|
||||||
.send((self.worker.clone(), WorkerScriptMsg::Common(msg)))
|
.send((self.worker.clone(), WorkerScriptMsg::Common(msg)))
|
||||||
.map_err(|_| ());
|
.map_err(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl KeyboardEvent {
|
||||||
if self.meta.get() {
|
if self.meta.get() {
|
||||||
result = result | constellation_msg::SUPER;
|
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
|
self.renderer
|
||||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
return Ok(());
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => return Err(WebGLError::InvalidEnum),
|
_ => Err(WebGLError::InvalidEnum),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
constants::TEXTURE_MAG_FILTER => {
|
constants::TEXTURE_MAG_FILTER => {
|
||||||
|
@ -120,10 +120,10 @@ impl WebGLTexture {
|
||||||
self.renderer
|
self.renderer
|
||||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
return Ok(());
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => return Err(WebGLError::InvalidEnum),
|
_ => Err(WebGLError::InvalidEnum),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
constants::TEXTURE_WRAP_S |
|
constants::TEXTURE_WRAP_S |
|
||||||
|
@ -135,14 +135,14 @@ impl WebGLTexture {
|
||||||
self.renderer
|
self.renderer
|
||||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
.send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value)))
|
||||||
.unwrap();
|
.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 {
|
impl ScriptChan for MainThreadScriptChan {
|
||||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
|
||||||
let MainThreadScriptChan(ref chan) = *self;
|
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> {
|
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue