From 095d446ccda70c3174c31afe545bb11c22cf43be Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Tue, 6 Nov 2018 16:08:50 +0100 Subject: [PATCH] Manually format remaining problems Use line comments instead of block comments as block comments contain trailing whitespace after formatting with rustfmt. Skip tests for malloc_size_of and script_plugins with rustfmt as they have many block comments. --- components/gfx/text/glyph.rs | 19 +++++++++-------- components/script/dom/bindings/utils.rs | 27 +++++++++++++------------ components/script/dom/url.rs | 9 +++------ tests/unit/malloc_size_of/lib.rs | 25 ++++++++++++----------- tests/unit/script_plugins/lib.rs | 23 +++++++++++---------- 5 files changed, 51 insertions(+), 52 deletions(-) diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 5e37f3eb94c..3f3a92ccb7a 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -223,16 +223,15 @@ impl<'a> DetailedGlyphStore { entry_offset, glyphs ); - /* TODO: don't actually assert this until asserts are compiled - in/out based on severity, debug/release, etc. This assertion - would wreck the complexity of the lookup. - - See Rust Issue #3647, #2228, #3627 for related information. - - do self.detail_lookup.borrow |arr| { - assert !arr.contains(entry) - } - */ + // TODO: don't actually assert this until asserts are compiled + // in/out based on severity, debug/release, etc. This assertion + // would wreck the complexity of the lookup. + // + // See Rust Issue #3647, #2228, #3627 for related information. + // + // do self.detail_lookup.borrow |arr| { + // assert !arr.contains(entry) + // } self.detail_lookup.push(entry); self.detail_buffer.extend_from_slice(glyphs); diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 9ad2122430f..7a48349e594 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -172,19 +172,20 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Option None } // if id is length atom, -1, otherwise - /*return if JSID_IS_ATOM(id) { - let atom = JSID_TO_ATOM(id); - //let s = *GetAtomChars(id); - if s > 'a' && s < 'z' { - return -1; - } - - let i = 0; - let str = AtomToLinearString(JSID_TO_ATOM(id)); - return if StringIsArray(str, &mut i) != 0 { i } else { -1 } - } else { - IdToInt32(cx, id); - }*/} + // return if JSID_IS_ATOM(id) { + // let atom = JSID_TO_ATOM(id); + // //let s = *GetAtomChars(id); + // if s > 'a' && s < 'z' { + // return -1; + // } + // + // let i = 0; + // let str = AtomToLinearString(JSID_TO_ATOM(id)); + // return if StringIsArray(str, &mut i) != 0 { i } else { -1 } + // } else { + // IdToInt32(cx, id); + // } +} /// Find the enum equivelent of a string given by `v` in `pairs`. /// Returns `Err(())` on JSAPI failure (there is a pending exception), and diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 25e0274cbf5..22f5f9a0fdc 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -118,12 +118,9 @@ impl URL { // https://w3c.github.io/FileAPI/#dfn-revokeObjectURL pub fn RevokeObjectURL(global: &GlobalScope, url: DOMString) { - /* - If the value provided for the url argument is not a Blob URL OR - if the value provided for the url argument does not have an entry in the Blob URL Store, - - this method call does nothing. User agents may display a message on the error console. - */ + // If the value provided for the url argument is not a Blob URL OR + // if the value provided for the url argument does not have an entry in the Blob URL Store, + // this method call does nothing. User agents may display a message on the error console. let origin = get_blob_origin(&global.get_url()); if let Ok(url) = ServoUrl::parse(&url) { diff --git a/tests/unit/malloc_size_of/lib.rs b/tests/unit/malloc_size_of/lib.rs index dd933402623..74e8a809ea9 100644 --- a/tests/unit/malloc_size_of/lib.rs +++ b/tests/unit/malloc_size_of/lib.rs @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#![rustfmt::skip] /** ``` @@ -25,9 +26,9 @@ pub mod does_not_impl_malloc_size_of { ```compile_fail,E0277 extern crate malloc_size_of; extern crate servo_arc; - + fn sizeable() {} - + fn main() { sizeable::>(); } @@ -38,9 +39,9 @@ pub mod does_not_impl_malloc_size_of { /** ```compile_fail,E0277 extern crate malloc_size_of; - + fn sizeable() {} - + fn main() { sizeable::>(); } @@ -51,9 +52,9 @@ pub mod does_not_impl_malloc_size_of { /** ```compile_fail,E0277 extern crate malloc_size_of; - + fn sizeable() {} - + fn main() { sizeable::>(); } @@ -67,9 +68,9 @@ pub mod does_not_impl_malloc_shallow_size_of { ```compile_fail,E0277 extern crate malloc_size_of; extern crate servo_arc; - + fn shallow_sizeable() {} - + fn main() { shallow_sizeable::>(); } @@ -80,9 +81,9 @@ pub mod does_not_impl_malloc_shallow_size_of { /** ```compile_fail,E0277 extern crate malloc_size_of; - + fn shallow_sizeable() {} - + fn main() { shallow_sizeable::>(); } @@ -93,9 +94,9 @@ pub mod does_not_impl_malloc_shallow_size_of { /** ```compile_fail,E0277 extern crate malloc_size_of; - + fn shallow_sizeable() {} - + fn main() { shallow_sizeable::>(); } diff --git a/tests/unit/script_plugins/lib.rs b/tests/unit/script_plugins/lib.rs index f27a16f2e32..f0f668b6e27 100644 --- a/tests/unit/script_plugins/lib.rs +++ b/tests/unit/script_plugins/lib.rs @@ -1,19 +1,20 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#![rustfmt::skip] pub mod unrooted_must_root { /** ``` #![feature(plugin)] #![plugin(script_plugins)] - + #[must_root] struct Foo(i32); #[must_root] struct Bar(Foo); - + fn foo1(_: &Foo) {} fn foo2(_: &()) -> &Foo { unimplemented!() } - + fn main() {} ``` */ @@ -23,10 +24,10 @@ pub mod unrooted_must_root { ```compile_fail #![feature(plugin)] #![plugin(script_plugins)] - + #[must_root] struct Foo(i32); struct Bar(Foo); - + fn main() {} ``` */ @@ -36,11 +37,11 @@ pub mod unrooted_must_root { ```compile_fail #![feature(plugin)] #![plugin(script_plugins)] - + #[must_root] struct Foo(i32); - + fn foo1(_: Foo) {} - + fn main() {} ``` */ @@ -50,11 +51,11 @@ pub mod unrooted_must_root { ```compile_fail #![feature(plugin)] #![plugin(script_plugins)] - + #[must_root] struct Foo(i32); - + fn foo2() -> Foo { unimplemented!() } - + fn main() {} ``` */