Skip to content

Commit

Permalink
Auto merge of #7680 - Mylainos:Issue-#7390, r=metajack
Browse files Browse the repository at this point in the history
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 -->
  • Loading branch information
bors-servo committed Sep 18, 2015
2 parents 9b93954 + 6565e7b commit d1b85de
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 53 deletions.
4 changes: 2 additions & 2 deletions components/compositing/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions components/layout/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ 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;
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;
Expand Down
12 changes: 6 additions & 6 deletions components/net/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions components/plugins/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 6 additions & 7 deletions components/script/dom/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -179,4 +179,3 @@ pub mod codegen {
include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs"));
}
}

36 changes: 18 additions & 18 deletions components/script/dom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions components/script/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions components/style/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions components/util/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions ports/gonk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ use util::opts;

use std::env;

mod window;
mod input;
mod window;

struct BrowserWrapper {
browser: Browser,
Expand Down Expand Up @@ -105,4 +105,3 @@ fn main() {
} = browser;
browser.shutdown();
}

25 changes: 25 additions & 0 deletions python/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def check_rust(file_name, contents):

uses = []

mods = []

for idx, line in enumerate(contents):
# simplify the analysis
line = line.strip()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit d1b85de

Please sign in to comment.