diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-09-18 14:44:48 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-09-18 14:44:48 -0600 |
commit | d1b85de762c0193276010a019f931526c34c04ce (patch) | |
tree | 0b371fa5d7fd2674793843f4c3034a9ff81c25e9 | |
parent | 9b939546a660fb24985e54aba1c2c47d1cf057a4 (diff) | |
parent | 6565e7b02fafea933e27e59bed1db876b56ac005 (diff) | |
download | servo-d1b85de762c0193276010a019f931526c34c04ce.tar.gz servo-d1b85de762c0193276010a019f931526c34c04ce.zip |
Auto merge of #7680 - Mylainos:Issue-#7390, r=metajack
fixes #7390 : tidy now check the order of mod declarations even whith attribute
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7680)
<!-- Reviewable:end -->
-rw-r--r-- | components/compositing/lib.rs | 4 | ||||
-rw-r--r-- | components/gfx/lib.rs | 2 | ||||
-rw-r--r-- | components/layout/lib.rs | 8 | ||||
-rw-r--r-- | components/net/lib.rs | 12 | ||||
-rw-r--r-- | components/plugins/lib.rs | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/mod.rs | 13 | ||||
-rw-r--r-- | components/script/dom/mod.rs | 36 | ||||
-rw-r--r-- | components/script/lib.rs | 8 | ||||
-rw-r--r-- | components/style/lib.rs | 8 | ||||
-rw-r--r-- | components/util/lib.rs | 6 | ||||
-rw-r--r-- | ports/gonk/src/main.rs | 3 | ||||
-rw-r--r-- | python/tidy.py | 25 |
12 files changed, 76 insertions, 53 deletions
diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index c4d9746587a..8852fe0acf8 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -49,11 +49,11 @@ pub use constellation::Constellation; pub mod compositor_task; -mod surface_map; -mod compositor_layer; mod compositor; +mod compositor_layer; mod headless; mod scrolling; +mod surface_map; pub mod pipeline; pub mod constellation; diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index af3c6017906..e6f602a022e 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -85,8 +85,8 @@ pub mod paint_task; // Fonts pub mod font; -pub mod font_context; pub mod font_cache_task; +pub mod font_context; pub mod font_template; // Misc. diff --git a/components/layout/lib.rs b/components/layout/lib.rs index a524236fac0..d00c031b504 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -79,9 +79,9 @@ pub mod flow_list; pub mod flow_ref; pub mod fragment; pub mod generated_content; -pub mod layout_task; pub mod incremental; pub mod inline; +pub mod layout_task; pub mod list_item; pub mod model; pub mod multicol; @@ -89,13 +89,13 @@ pub mod opaque_node; pub mod parallel; pub mod query; pub mod sequential; -pub mod table_wrapper; pub mod table; pub mod table_caption; +pub mod table_cell; pub mod table_colgroup; -pub mod table_rowgroup; pub mod table_row; -pub mod table_cell; +pub mod table_rowgroup; +pub mod table_wrapper; pub mod text; pub mod traversal; pub mod wrapper; diff --git a/components/net/lib.rs b/components/net/lib.rs index 5c9378114fe..c0077d2e0f0 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -27,22 +27,22 @@ extern crate url; extern crate uuid; pub mod about_loader; -pub mod file_loader; -pub mod http_loader; -pub mod data_loader; pub mod cookie; pub mod cookie_storage; +pub mod data_loader; +pub mod file_loader; +pub mod hsts; +pub mod http_loader; pub mod image_cache_task; +pub mod mime_classifier; pub mod pub_domains; pub mod resource_task; -pub mod hsts; pub mod storage_task; -pub mod mime_classifier; /// An implementation of the [Fetch spec](https://fetch.spec.whatwg.org/) pub mod fetch { #![allow(dead_code, unused)] // XXXManishearth this is only temporary until the Fetch mod starts being used + pub mod cors_cache; pub mod request; pub mod response; - pub mod cors_cache; } diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index 5a87cd32ce1..4124d552988 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -37,11 +37,11 @@ pub mod jstraceable; /// Handles the auto-deriving for `#[derive(HeapSizeOf)]` pub mod heap_size; /// Autogenerates implementations of Reflectable on DOM structs -pub mod reflector; pub mod lints; +pub mod reflector; /// Utilities for writing plugins -pub mod utils; pub mod casing; +pub mod utils; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 1ded213d0f4..d4236ba08f6 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -135,19 +135,19 @@ #![allow(unsafe_code)] #![deny(missing_docs, non_snake_case)] +pub mod callback; pub mod cell; +pub mod conversions; +pub mod error; pub mod global; pub mod js; -pub mod refcounted; -pub mod utils; -pub mod callback; -pub mod error; -pub mod conversions; -pub mod proxyhandler; pub mod num; +pub mod proxyhandler; +pub mod refcounted; pub mod str; pub mod structuredclone; pub mod trace; +pub mod utils; /// Generated JS-Rust bindings. #[allow(missing_docs, non_snake_case)] @@ -179,4 +179,3 @@ pub mod codegen { include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs")); } } - diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index a0f436e513b..77c7766c8eb 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -199,18 +199,13 @@ pub mod canvasgradient; pub mod canvaspattern; pub mod canvasrenderingcontext2d; pub mod characterdata; -pub mod css; -pub mod cssstyledeclaration; -pub mod dompoint; -pub mod dompointreadonly; -pub mod domrect; -pub mod domrectlist; -pub mod domstringmap; pub mod closeevent; pub mod comment; pub mod console; mod create; pub mod crypto; +pub mod css; +pub mod cssstyledeclaration; pub mod customevent; pub mod dedicatedworkerglobalscope; pub mod document; @@ -219,6 +214,11 @@ pub mod documenttype; pub mod domexception; pub mod domimplementation; pub mod domparser; +pub mod dompoint; +pub mod dompointreadonly; +pub mod domrect; +pub mod domrectlist; +pub mod domstringmap; pub mod domtokenlist; pub mod element; pub mod errorevent; @@ -280,15 +280,15 @@ pub mod htmlprogresselement; pub mod htmlquoteelement; pub mod htmlscriptelement; pub mod htmlselectelement; -pub mod htmlspanelement; pub mod htmlsourceelement; +pub mod htmlspanelement; pub mod htmlstyleelement; -pub mod htmltableelement; pub mod htmltablecaptionelement; pub mod htmltablecellelement; +pub mod htmltablecolelement; pub mod htmltabledatacellelement; +pub mod htmltableelement; pub mod htmltableheadercellelement; -pub mod htmltablecolelement; pub mod htmltablerowelement; pub mod htmltablesectionelement; pub mod htmltemplateelement; @@ -297,8 +297,8 @@ pub mod htmltimeelement; pub mod htmltitleelement; pub mod htmltrackelement; pub mod htmlulistelement; -pub mod htmlvideoelement; pub mod htmlunknownelement; +pub mod htmlvideoelement; pub mod imagedata; pub mod keyboardevent; pub mod location; @@ -310,9 +310,9 @@ pub mod navigatorinfo; pub mod node; pub mod nodeiterator; pub mod nodelist; -pub mod processinginstruction; pub mod performance; pub mod performancetiming; +pub mod processinginstruction; pub mod progressevent; pub mod range; pub mod screen; @@ -330,17 +330,17 @@ pub mod urlsearchparams; pub mod userscripts; pub mod validitystate; pub mod virtualmethods; -pub mod webglobject; +pub mod webglactiveinfo; pub mod webglbuffer; +pub mod webglframebuffer; +pub mod webglobject; pub mod webglprogram; +pub mod webglrenderbuffer; pub mod webglrenderingcontext; pub mod webglshader; -pub mod webgluniformlocation; -pub mod webgltexture; -pub mod webglframebuffer; -pub mod webglrenderbuffer; -pub mod webglactiveinfo; pub mod webglshaderprecisionformat; +pub mod webgltexture; +pub mod webgluniformlocation; pub mod websocket; pub mod window; pub mod worker; diff --git a/components/script/lib.rs b/components/script/lib.rs index 325e9cba1e0..6f015063dde 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -91,16 +91,16 @@ pub mod dom; pub mod parse; +pub mod clipboard_provider; +mod devtools; +mod horribly_inefficient_timers; pub mod layout_interface; mod mem; mod network_listener; pub mod page; pub mod script_task; -mod timers; pub mod textinput; -pub mod clipboard_provider; -mod devtools; -mod horribly_inefficient_timers; +mod timers; mod webdriver_handlers; use dom::bindings::codegen::RegisterBindings; diff --git a/components/style/lib.rs b/components/style/lib.rs index 425a5eafb06..951520067a3 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -47,9 +47,9 @@ extern crate util; extern crate style_traits; mod custom_properties; -pub mod stylesheets; pub mod parser; pub mod selector_matching; +pub mod stylesheets; #[macro_use] pub mod values; // Generated from the properties.mako.rs template by build.rs @@ -58,11 +58,11 @@ pub mod properties { include!(concat!(env!("OUT_DIR"), "/properties.rs")); } -pub mod node; -pub mod media_queries; +pub mod animation; pub mod font_face; pub mod legacy; -pub mod animation; +pub mod media_queries; +pub mod node; pub mod viewport; macro_rules! reexport_computed_values { diff --git a/components/util/lib.rs b/components/util/lib.rs index 7ff5b1dd720..bdb2ccb99fc 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -53,9 +53,9 @@ pub mod cache; pub mod cursor; pub mod debug_utils; pub mod deque; -pub mod linked_list; pub mod geometry; pub mod ipc; +pub mod linked_list; pub mod logical_geometry; pub mod mem; pub mod opts; @@ -66,9 +66,9 @@ pub mod range; pub mod resource_files; pub mod str; pub mod task; -pub mod tid; -pub mod taskpool; pub mod task_state; +pub mod taskpool; +pub mod tid; pub mod vec; pub mod workqueue; diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs index 8c6053dffab..2ef85dcf833 100644 --- a/ports/gonk/src/main.rs +++ b/ports/gonk/src/main.rs @@ -51,8 +51,8 @@ use util::opts; use std::env; -mod window; mod input; +mod window; struct BrowserWrapper { browser: Browser, @@ -105,4 +105,3 @@ fn main() { } = browser; browser.shutdown(); } - diff --git a/python/tidy.py b/python/tidy.py index d637c9178f6..12057d665d8 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -203,6 +203,8 @@ def check_rust(file_name, contents): uses = [] + mods = [] + for idx, line in enumerate(contents): # simplify the analysis line = line.strip() @@ -305,6 +307,29 @@ def check_rust(file_name, contents): yield (idx + 1 - len(uses) + i, message + expected + found) uses = [] + # modules must be in the same line and alphabetically sorted + if line.startswith("mod ") or line.startswith("pub mod "): + mod = "" + if line.startswith("mod "): + mod = line[4:] + else: + mod = line[8:] + + match = line.find(" {") + if match == -1: + if not mod.endswith(";"): + yield (idx + 1, "mod statement spans multiple lines") + mods.append(mod[:len(mod) - 1]) + elif len(mods) > 0: + sorted_mods = sorted(mods) + for i in range(len(mods)): + if sorted_mods[i] != mods[i]: + message = "mod statement is not in alphabetical order" + expected = "\n\t\033[93mexpected: {}\033[0m".format(sorted_mods[i]) + found = "\n\t\033[91mfound: {}\033[0m".format(mods[i]) + yield (idx + 1 - len(mods) + i, message + expected + found) + mods = [] + # Avoid flagging <Item=Foo> constructs def is_associated_type(match, line, index): |