diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index b77847eb1c8..9aa479aa06e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -2261,8 +2261,7 @@ impl IOCompositor { rendergl::render_scene(layer.clone(), context, &self.scene); gl::disable(gl::SCISSOR_TEST); - } - else { + } else { rendergl::render_scene(layer.clone(), context, &self.scene); } } diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 71255e38c51..5a8d8580bd6 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -1788,8 +1788,11 @@ impl ScaledFontExtensionMethods for ScaledFont { let mut options = struct__AzDrawOptions { mAlpha: 1f64 as AzFloat, mCompositionOp: CompositionOp::Over as u8, - mAntialiasMode: if antialias { AntialiasMode::Subpixel as u8 } - else { AntialiasMode::None as u8 } + mAntialiasMode: if antialias { + AntialiasMode::Subpixel as u8 + } else { + AntialiasMode::None as u8 + } }; let mut origin = baseline_origin.clone(); diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 815a276330f..9c72413d320 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -81,12 +81,12 @@ pub fn load_from_memory(buffer: &[u8]) -> Option { // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img pub fn detect_image_format(buffer: &[u8]) -> Result { - if is_gif(buffer) { Ok(ImageFormat::GIF) } - else if is_jpeg(buffer) { Ok(ImageFormat::JPEG) } - else if is_png(buffer) { Ok(ImageFormat::PNG) } - else if is_bmp(buffer) { Ok(ImageFormat::BMP) } - else if is_ico(buffer) { Ok(ImageFormat::ICO) } - else { Err("Image Format Not Supported") } + if is_gif(buffer) { Ok(ImageFormat::GIF) + } else if is_jpeg(buffer) { Ok(ImageFormat::JPEG) + } else if is_png(buffer) { Ok(ImageFormat::PNG) + } else if is_bmp(buffer) { Ok(ImageFormat::BMP) + } else if is_ico(buffer) { Ok(ImageFormat::ICO) + } else { Err("Image Format Not Supported") } } fn is_gif(buffer: &[u8]) -> bool { diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 70563ec95c7..49d42c31f1a 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -133,9 +133,8 @@ impl AsyncResponseListener for HTMLMediaElementContext { // Step 5 elem.fire_simple_event("error"); - } - // => "If the media data cannot be fetched at all..." - else { + } else { + // => "If the media data cannot be fetched at all..." elem.queue_dedicated_media_source_failure_steps(); } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index c3fc2e00dc8..7b2fc0e5a15 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -1128,9 +1128,8 @@ impl XMLHttpRequest { // Step 5 if self.response_type.get() == XMLHttpRequestResponseType::_empty { return None; - } - // Step 6 - else { + } else { + // Step 6 temp_doc = self.document_text_html(); } }, @@ -1143,8 +1142,7 @@ impl XMLHttpRequest { Some(Mime(_, mime::SubLevel::Ext(sub), _)) => { if sub.ends_with("+xml") { temp_doc = self.handle_xml(); - } - else { + } else { return None; } }, diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index fe19f52fafa..16395e53bc0 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -374,8 +374,7 @@ pub fn handle_is_selected(context: &BrowsingContext, } else if let Some(_) = node.downcast::() { Ok(false) // regular elements are not selectable - } - else { + } else { Err(()) } }, diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 751039c0ad1..3b1b443eb87 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -415,6 +415,7 @@ def check_rust(file_name, lines): (r"^&&", "operators should go at the end of the first line", no_filter), (r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import", lambda match, line: line.startswith('use ')), + (r"^\s*else {", "else braces should be on the same line", no_filter), ] for pattern, message, filter_func in regex_rules: diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs index 2b9dd343f2d..9bc37070613 100644 --- a/python/tidy/servo_tidy_tests/rust_tidy.rs +++ b/python/tidy/servo_tidy_tests/rust_tidy.rs @@ -41,6 +41,12 @@ impl test { let x = true; x && x; + if x { + ; + } + else { + ; + } } } diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index dbbc77c9e23..4a90f94b6b9 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -76,6 +76,7 @@ class CheckTidiness(unittest.TestCase): self.assertEqual('use &str instead of &String', errors.next()[2]) self.assertEqual('use &T instead of &Root', errors.next()[2]) self.assertEqual('operators should go at the end of the first line', errors.next()[2]) + self.assertEqual('else braces should be on the same line', errors.next()[2]) self.assertNoMoreErrors(errors) def test_spec_link(self):