diff options
-rw-r--r-- | components/canvas/lib.rs | 4 | ||||
-rw-r--r-- | components/compositing/lib.rs | 18 | ||||
-rw-r--r-- | components/devtools/lib.rs | 4 | ||||
-rw-r--r-- | components/gfx/lib.rs | 20 | ||||
-rw-r--r-- | components/layout/lib.rs | 20 | ||||
-rw-r--r-- | components/layout_traits/lib.rs | 4 | ||||
-rw-r--r-- | components/msg/lib.rs | 2 | ||||
-rw-r--r-- | components/net/lib.rs | 6 | ||||
-rw-r--r-- | components/net_traits/lib.rs | 6 | ||||
-rw-r--r-- | components/plugins/lib.rs | 10 | ||||
-rw-r--r-- | components/profile/lib.rs | 11 | ||||
-rw-r--r-- | components/profile_traits/energy.rs | 2 | ||||
-rw-r--r-- | components/script/lib.rs | 20 | ||||
-rw-r--r-- | components/servo/lib.rs | 4 | ||||
-rw-r--r-- | components/servo/main.rs | 9 | ||||
-rw-r--r-- | components/style/lib.rs | 10 | ||||
-rw-r--r-- | components/util/lib.rs | 14 | ||||
-rw-r--r-- | components/webdriver_server/lib.rs | 4 | ||||
-rw-r--r-- | ports/glutin/lib.rs | 4 | ||||
-rw-r--r-- | ports/gonk/src/main.rs | 22 | ||||
-rw-r--r-- | python/tidy.py | 19 | ||||
-rw-r--r-- | tests/unit/script/lib.rs | 2 |
22 files changed, 109 insertions, 106 deletions
diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 67b8bc58d0c..b8ec951bbef 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -9,8 +9,6 @@ #![feature(plugin)] #![plugin(plugins)] -#[macro_use] -extern crate log; extern crate azure; extern crate canvas_traits; extern crate core; @@ -20,6 +18,8 @@ extern crate gfx_traits; extern crate gleam; extern crate ipc_channel; extern crate layers; +#[macro_use] +extern crate log; extern crate num; extern crate offscreen_gl_context; extern crate util; diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index fa2ad24fd60..4d9e2e0c9fe 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -16,22 +16,15 @@ #![plugin(serde_macros)] extern crate app_units; -#[macro_use] -extern crate log; -#[macro_use] -extern crate profile_traits; -#[macro_use] -extern crate util; + extern crate azure; extern crate canvas; extern crate canvas_traits; extern crate clipboard; - #[cfg(target_os = "macos")] extern crate core_graphics; #[cfg(target_os = "macos")] extern crate core_text; - extern crate devtools_traits; extern crate euclid; extern crate gaol; @@ -42,17 +35,22 @@ extern crate image; extern crate ipc_channel; extern crate layers; extern crate layout_traits; +extern crate libc; +#[macro_use] +extern crate log; extern crate msg; extern crate net_traits; extern crate num; extern crate offscreen_gl_context; +#[macro_use] +extern crate profile_traits; extern crate script_traits; extern crate serde; extern crate style_traits; - -extern crate libc; extern crate time; extern crate url; +#[macro_use] +extern crate util; pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask}; pub use constellation::Constellation; diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 6a627f9a88f..22baef2e1e8 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -19,11 +19,11 @@ #![allow(non_snake_case)] #![deny(unsafe_code)] -#[macro_use] -extern crate log; extern crate devtools_traits; extern crate hyper; extern crate ipc_channel; +#[macro_use] +extern crate log; extern crate msg; extern crate rustc_serialize; extern crate serde; diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index c1848813464..9fdacc72d19 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -20,19 +20,11 @@ #![plugin(plugins)] #![plugin(serde_macros)] +extern crate alloc; extern crate app_units; +extern crate azure; #[macro_use] extern crate bitflags; -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate log; -#[macro_use] -extern crate profile_traits; -#[macro_use] -extern crate util; -extern crate alloc; -extern crate azure; extern crate canvas_traits; // Mac OS-specific library dependencies @@ -57,9 +49,15 @@ extern crate harfbuzz_sys as harfbuzz; extern crate ipc_channel; extern crate layers; +#[macro_use] +extern crate lazy_static; extern crate libc; +#[macro_use] +extern crate log; extern crate msg; extern crate net_traits; +#[macro_use] +extern crate profile_traits; extern crate rand; extern crate rustc_serialize; extern crate script_traits; @@ -75,6 +73,8 @@ extern crate style; extern crate time; extern crate unicode_script; extern crate url; +#[macro_use] +extern crate util; pub use paint_context::PaintContext; diff --git a/components/layout/lib.rs b/components/layout/lib.rs index a19bf5aa42e..c4aec9bdd76 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -19,18 +19,9 @@ #![plugin(plugins)] extern crate app_units; +extern crate azure; #[macro_use] extern crate bitflags; -#[macro_use] -extern crate log; -#[macro_use] -extern crate profile_traits; -#[macro_use] -#[no_link] -extern crate plugins as servo_plugins; -#[macro_use] -extern crate util; -extern crate azure; extern crate canvas_traits; extern crate clock_ticks; extern crate cssparser; @@ -42,8 +33,15 @@ extern crate gfx_traits; extern crate ipc_channel; extern crate layout_traits; extern crate libc; +#[macro_use] +extern crate log; extern crate msg; extern crate net_traits; +#[macro_use] +#[no_link] +extern crate plugins as servo_plugins; +#[macro_use] +extern crate profile_traits; extern crate rustc_serialize; extern crate script; extern crate script_traits; @@ -57,6 +55,8 @@ extern crate style_traits; extern crate unicode_bidi; extern crate unicode_script; extern crate url; +#[macro_use] +extern crate util; #[macro_use] mod layout_debug; diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 50024754ba4..bbcb1d612d8 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -8,10 +8,10 @@ extern crate euclid; extern crate gfx; extern crate ipc_channel; -extern crate script_traits; extern crate msg; -extern crate profile_traits; extern crate net_traits; +extern crate profile_traits; +extern crate script_traits; extern crate serde; extern crate url; extern crate util; diff --git a/components/msg/lib.rs b/components/msg/lib.rs index e5be66832f0..c989835e7ea 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -6,9 +6,9 @@ #![plugin(serde_macros, plugins)] extern crate app_units; +extern crate azure; #[macro_use] extern crate bitflags; -extern crate azure; extern crate canvas_traits; #[cfg(target_os = "macos")] extern crate core_foundation; diff --git a/components/net/lib.rs b/components/net/lib.rs index 3fe4fba3d2c..709c2cb0126 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -11,15 +11,15 @@ #![feature(plugin)] #![plugin(plugins)] -#[macro_use] -extern crate log; +extern crate brotli; extern crate cookie as cookie_rs; extern crate devtools_traits; extern crate euclid; extern crate flate2; -extern crate brotli; extern crate hyper; extern crate ipc_channel; +#[macro_use] +extern crate log; extern crate mime_guess; extern crate msg; extern crate net_traits; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 8deca7362cb..f753ca6078c 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -12,12 +12,12 @@ #![feature(custom_attribute)] #![plugin(serde_macros, plugins)] -#[macro_use] -extern crate log; extern crate euclid; extern crate hyper; -extern crate ipc_channel; extern crate image as piston_image; +extern crate ipc_channel; +#[macro_use] +extern crate log; extern crate msg; extern crate serde; extern crate stb_image; diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index 6662825452b..f29442be383 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -15,16 +15,14 @@ #![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, slice_patterns)] -#[macro_use] -extern crate syntax; +#[cfg(feature = "clippy")] +extern crate clippy; #[macro_use] extern crate rustc; - extern crate rustc_front; - +#[macro_use] +extern crate syntax; extern crate tenacious; -#[cfg(feature = "clippy")] -extern crate clippy; extern crate url; diff --git a/components/profile/lib.rs b/components/profile/lib.rs index 93888cc4768..3ec554a39e6 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -9,20 +9,19 @@ #![feature(plugin)] #![plugin(plugins)] -#[macro_use] -extern crate log; -#[macro_use] -extern crate profile_traits; - extern crate alloc_jemalloc; extern crate hbs_pow; extern crate ipc_channel; extern crate libc; +#[macro_use] +extern crate log; +#[macro_use] +extern crate profile_traits; #[cfg(target_os = "linux")] extern crate regex; -extern crate time as std_time; #[cfg(target_os = "macos")] extern crate task_info; +extern crate time as std_time; extern crate util; mod heartbeats; diff --git a/components/profile_traits/energy.rs b/components/profile_traits/energy.rs index 23554386f77..1e34645b180 100644 --- a/components/profile_traits/energy.rs +++ b/components/profile_traits/energy.rs @@ -25,8 +25,8 @@ pub fn energy_interval_ms() -> u32 { #[cfg(feature = "energy-profiling")] mod energymon { - extern crate energymon; extern crate energy_monitor; + extern crate energymon; use self::energy_monitor::EnergyMonitor; use self::energymon::EnergyMon; diff --git a/components/script/lib.rs b/components/script/lib.rs index 4f1d9f66cd0..583f837bfbf 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -33,19 +33,10 @@ #![plugin(plugins)] +extern crate angle; extern crate app_units; #[macro_use] extern crate bitflags; -#[macro_use] -extern crate log; -#[macro_use] -extern crate profile_traits; -#[macro_use] -extern crate style; -extern crate style_traits; -#[macro_use] -extern crate util; -extern crate angle; extern crate canvas; extern crate canvas_traits; extern crate caseless; @@ -61,10 +52,14 @@ extern crate image; extern crate ipc_channel; extern crate js; extern crate libc; +#[macro_use] +extern crate log; extern crate msg; extern crate net_traits; extern crate num; extern crate offscreen_gl_context; +#[macro_use] +extern crate profile_traits; extern crate rand; extern crate rustc_serialize; extern crate rustc_unicode; @@ -73,10 +68,15 @@ extern crate script_traits; extern crate serde; extern crate smallvec; #[macro_use(atom, ns)] extern crate string_cache; +#[macro_use] +extern crate style; +extern crate style_traits; extern crate tendril; extern crate time; extern crate unicase; extern crate url; +#[macro_use] +extern crate util; extern crate uuid; extern crate websocket; diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 4e5af217b5a..3f21db22c70 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -18,7 +18,7 @@ // `WindowMethods` trait. extern crate gaol; - +extern crate libc; #[macro_use] extern crate util as _util; @@ -45,8 +45,6 @@ mod export { extern crate url; } -extern crate libc; - #[cfg(feature = "webdriver")] extern crate webdriver_server; diff --git a/components/servo/main.rs b/components/servo/main.rs index 3c17be5503d..7b3f6ead2c2 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -20,20 +20,19 @@ #[cfg(target_os = "android")] #[macro_use] extern crate android_glue; +extern crate env_logger; +extern crate gleam; // The window backed by glutin extern crate glutin_app as app; -extern crate env_logger; #[cfg(target_os = "android")] extern crate libc; #[macro_use] extern crate log; +extern crate offscreen_gl_context; // The Servo engine extern crate servo; extern crate time; -extern crate gleam; -extern crate offscreen_gl_context; - use gleam::gl; use offscreen_gl_context::GLContext; use servo::Browser; @@ -222,8 +221,8 @@ android_start!(main); #[cfg(target_os = "android")] mod android { - extern crate libc; extern crate android_glue; + extern crate libc; use self::libc::c_int; use std::borrow::ToOwned; diff --git a/components/style/lib.rs b/components/style/lib.rs index 576cccd01fb..a6938cd7b47 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -20,23 +20,23 @@ extern crate app_units; extern crate bitflags; #[macro_use] extern crate cssparser; +extern crate encoding; +extern crate euclid; +extern crate fnv; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate matches; -#[macro_use] -extern crate style_traits; -extern crate encoding; -extern crate euclid; -extern crate fnv; extern crate num; extern crate rustc_serialize; #[macro_use(state_pseudo_classes)] extern crate selectors; extern crate serde; extern crate smallvec; #[macro_use(atom, ns)] extern crate string_cache; +#[macro_use] +extern crate style_traits; extern crate url; extern crate util; diff --git a/components/util/lib.rs b/components/util/lib.rs index da6e382dc7f..f39940fd78d 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -20,17 +20,13 @@ #![plugin(plugins, serde_macros)] +extern crate alloc; extern crate app_units; +extern crate azure; #[macro_use] extern crate bitflags; #[macro_use] extern crate cssparser; -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate log; -extern crate alloc; -extern crate azure; extern crate euclid; extern crate getopts; extern crate html5ever; @@ -38,9 +34,13 @@ extern crate hyper; extern crate ipc_channel; extern crate js; extern crate layers; +#[macro_use] +extern crate lazy_static; extern crate libc; -extern crate num_cpus; +#[macro_use] +extern crate log; extern crate num as num_lib; +extern crate num_cpus; extern crate rand; extern crate rustc_serialize; extern crate selectors; diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 22acb46d52d..0f01059005c 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -8,11 +8,11 @@ #![feature(ip_addr, plugin)] #![plugin(plugins)] -#[macro_use] -extern crate log; extern crate hyper; extern crate image; extern crate ipc_channel; +#[macro_use] +extern crate log; extern crate msg; extern crate regex; extern crate rustc_serialize; diff --git a/ports/glutin/lib.rs b/ports/glutin/lib.rs index b7fb8fcce25..ed1521221d1 100644 --- a/ports/glutin/lib.rs +++ b/ports/glutin/lib.rs @@ -9,6 +9,7 @@ #[macro_use] extern crate bitflags; #[cfg(target_os = "macos")] extern crate cgl; extern crate compositing; +#[cfg(target_os = "android")] extern crate egl; extern crate euclid; extern crate gleam; extern crate glutin; @@ -18,9 +19,8 @@ extern crate msg; extern crate net_traits; #[cfg(feature = "window")] extern crate script_traits; extern crate time; -extern crate util; -#[cfg(target_os = "android")] extern crate egl; extern crate url; +extern crate util; #[cfg(target_os = "linux")] extern crate x11; use compositing::windowing::WindowEvent; diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs index 80f5a4624e5..75b31dfa71a 100644 --- a/ports/gonk/src/main.rs +++ b/ports/gonk/src/main.rs @@ -23,23 +23,21 @@ //! //! [glutin]: https://github.com/tomaka/glutin -extern crate servo; -extern crate time; -extern crate util; -extern crate errno; - extern crate compositing; -extern crate script_traits; - +extern crate egl; +extern crate env_logger; +extern crate errno; extern crate euclid; -extern crate libc; -extern crate msg; extern crate gleam; extern crate layers; -extern crate egl; -extern crate url; +extern crate libc; +extern crate msg; extern crate net_traits; -extern crate env_logger; +extern crate script_traits; +extern crate servo; +extern crate time; +extern crate url; +extern crate util; #[link(name = "stlport")] extern {} diff --git a/python/tidy.py b/python/tidy.py index 65e59054caf..af79f66b3b4 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -221,12 +221,25 @@ def check_rust(file_name, contents): whitespace = False uses = [] - + prev_crate = {} mods = [] - for idx, line in enumerate(contents): + for idx, original_line in enumerate(contents): # simplify the analysis - line = line.strip() + line = original_line.strip() + + # check extern crates + if line.startswith("extern crate"): + crate_name = line.replace("extern crate ", "").replace(";", "") + indent = len(original_line) - len(line) + if indent not in prev_crate: + prev_crate[indent] = "" + if prev_crate[indent] > crate_name: + message = "extern crate statement is not in alphabetical order" + expected = "\n\t\033[93mexpected: {}\033[0m".format(prev_crate[indent]) + found = "\n\t\033[91mfound: {}\033[0m".format(crate_name) + yield(idx + 1, message + expected + found) + prev_crate[indent] = crate_name # Simple heuristic to avoid common case of no comments. if '/' in line: diff --git a/tests/unit/script/lib.rs b/tests/unit/script/lib.rs index 9f8064331b0..81c54e201f1 100644 --- a/tests/unit/script/lib.rs +++ b/tests/unit/script/lib.rs @@ -2,8 +2,8 @@ * 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/. */ -extern crate script; extern crate msg; +extern crate script; extern crate util; #[cfg(all(test, target_pointer_width = "64"))] mod size_of; |