aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-12-24 10:55:48 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-12-24 10:55:48 +0530
commitf77c7928868469ef4f326a269147ae2aee6151ee (patch)
tree683370f35c98b41a440e797b8b3aaeb4e8b37c93
parent9412e71460990f40ea7f9706fd79fbcd4eb0670a (diff)
parentcec661fa8656d61fad43addc1ea6f662105c2ca5 (diff)
downloadservo-f77c7928868469ef4f326a269147ae2aee6151ee.tar.gz
servo-f77c7928868469ef4f326a269147ae2aee6151ee.zip
Auto merge of #9055 - simartin:issue_9042, r=Wafflespeanut
Issue #9042: Report incorrect number of spaces around => in the style checker Fixes https://github.com/servo/servo/issues/9042 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9055) <!-- Reviewable:end -->
-rw-r--r--components/devtools/actors/network_event.rs6
-rw-r--r--components/gfx/paint_context.rs6
-rw-r--r--components/layout/display_list_builder.rs2
-rw-r--r--components/script/dom/document.rs52
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/util/debug_utils.rs2
-rw-r--r--python/tidy.py16
7 files changed, 48 insertions, 38 deletions
diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs
index 317dc096157..eb77f174a9d 100644
--- a/components/devtools/actors/network_event.rs
+++ b/components/devtools/actors/network_event.rs
@@ -359,7 +359,7 @@ impl NetworkEventActor {
let mut mString = "".to_owned();
if let Some(ref headers) = self.response.headers {
mString = match headers.get() {
- Some(&ContentType(ref mime)) => mime.to_string(),
+ Some(&ContentType(ref mime)) => mime.to_string(),
None => "".to_owned()
};
}
@@ -377,7 +377,7 @@ impl NetworkEventActor {
let mut cookies_size = 0;
if let Some(ref headers) = self.response.headers {
cookies_size = match headers.get() {
- Some(&Cookie(ref cookie)) => cookie.len(),
+ Some(&Cookie(ref cookie)) => cookie.len(),
None => 0
};
}
@@ -408,7 +408,7 @@ impl NetworkEventActor {
let mut cookies_size = 0;
if let Some(ref headers) = self.response.headers {
cookies_size = match headers.get() {
- Some(&Cookie(ref cookie)) => cookie.len(),
+ Some(&Cookie(ref cookie)) => cookie.len(),
None => 0
};
}
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index 0000c62f0ca..1270071825d 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -1251,9 +1251,9 @@ impl<'a> PaintContext<'a> {
0.5 * border.bottom,
0.5 * border.left);
let is_groove = match style {
- border_style::T::groove => true,
- border_style::T::ridge => false,
- _ => panic!("invalid border style")
+ border_style::T::groove => true,
+ border_style::T::ridge => false,
+ _ => panic!("invalid border style")
};
let lighter_color;
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 7370723a4df..7cc1d3f6311 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -1137,7 +1137,7 @@ impl FragmentDisplayListBuilding for Fragment {
if width > 0 && height > 0 {
let layer_id = self.layer_id();
let canvas_data = match canvas_fragment_info.ipc_renderer {
- Some(ref ipc_renderer) => {
+ Some(ref ipc_renderer) => {
let ipc_renderer = ipc_renderer.lock().unwrap();
let (sender, receiver) = ipc::channel().unwrap();
ipc_renderer.send(CanvasMsg::FromLayout(
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index d1e529f3bfa..6fe811ef168 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -381,32 +381,32 @@ impl Document {
pub fn set_encoding_name(&self, name: DOMString) {
*self.encoding_name.borrow_mut() = DOMString::from(
match name.as_ref() {
- "utf-8" => "UTF-8",
- "ibm866" => "IBM866",
- "iso-8859-2" => "ISO-8859-2",
- "iso-8859-3" => "ISO-8859-3",
- "iso-8859-4" => "ISO-8859-4",
- "iso-8859-5" => "ISO-8859-5",
- "iso-8859-6" => "ISO-8859-6",
- "iso-8859-7" => "ISO-8859-7",
- "iso-8859-8" => "ISO-8859-8",
- "iso-8859-8-i" => "ISO-8859-8-I",
- "iso-8859-10" => "ISO-8859-10",
- "iso-8859-13" => "ISO-8859-13",
- "iso-8859-14" => "ISO-8859-14",
- "iso-8859-15" => "ISO-8859-15",
- "iso-8859-16" => "ISO-8859-16",
- "koi8-r" => "KOI8-R",
- "koi8-u" => "KOI8-U",
- "gbk" => "GBK",
- "big5" => "Big5",
- "euc-jp" => "EUC-JP",
- "iso-2022-jp" => "ISO-2022-JP",
- "shift_jis" => "Shift_JIS",
- "euc-kr" => "EUC-KR",
- "utf-16be" => "UTF-16BE",
- "utf-16le" => "UTF-16LE",
- _ => &*name
+ "utf-8" => "UTF-8",
+ "ibm866" => "IBM866",
+ "iso-8859-2" => "ISO-8859-2",
+ "iso-8859-3" => "ISO-8859-3",
+ "iso-8859-4" => "ISO-8859-4",
+ "iso-8859-5" => "ISO-8859-5",
+ "iso-8859-6" => "ISO-8859-6",
+ "iso-8859-7" => "ISO-8859-7",
+ "iso-8859-8" => "ISO-8859-8",
+ "iso-8859-8-i" => "ISO-8859-8-I",
+ "iso-8859-10" => "ISO-8859-10",
+ "iso-8859-13" => "ISO-8859-13",
+ "iso-8859-14" => "ISO-8859-14",
+ "iso-8859-15" => "ISO-8859-15",
+ "iso-8859-16" => "ISO-8859-16",
+ "koi8-r" => "KOI8-R",
+ "koi8-u" => "KOI8-U",
+ "gbk" => "GBK",
+ "big5" => "Big5",
+ "euc-jp" => "EUC-JP",
+ "iso-2022-jp" => "ISO-2022-JP",
+ "shift_jis" => "Shift_JIS",
+ "euc-kr" => "EUC-KR",
+ "utf-16be" => "UTF-16BE",
+ "utf-16le" => "UTF-16LE",
+ _ => &*name
});
}
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 6515eb58471..a8f9ce28db5 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -464,7 +464,7 @@ pub enum FormSubmittableElement {
impl FormSubmittableElement {
fn as_event_target(&self) -> &EventTarget {
match *self {
- FormSubmittableElement::ButtonElement(ref button) => button.r().upcast(),
+ FormSubmittableElement::ButtonElement(ref button) => button.r().upcast(),
FormSubmittableElement::InputElement(ref input) => input.r().upcast(),
FormSubmittableElement::ObjectElement(ref object) => object.r().upcast(),
FormSubmittableElement::SelectElement(ref select) => select.r().upcast(),
diff --git a/components/util/debug_utils.rs b/components/util/debug_utils.rs
index 8c1954c78ba..631c7dad4ca 100644
--- a/components/util/debug_utils.rs
+++ b/components/util/debug_utils.rs
@@ -15,7 +15,7 @@ fn hexdump_slice(buf: &[u8]) {
stderr.write_all(output.as_bytes()).unwrap();
match i % 16 {
15 => { stderr.write_all(b"\n ").unwrap(); },
- 7 => { stderr.write_all(b" ").unwrap(); },
+ 7 => { stderr.write_all(b" ").unwrap(); },
_ => ()
}
stderr.flush().unwrap();
diff --git a/python/tidy.py b/python/tidy.py
index d974a89a1b8..d1a10522d4a 100644
--- a/python/tidy.py
+++ b/python/tidy.py
@@ -314,6 +314,16 @@ def check_rust(file_name, contents):
if match:
yield (idx + 1, "missing space after ->")
+ line_len = len(line)
+ arrow_pos = line.find("=>")
+ if arrow_pos != -1:
+ if arrow_pos and line[arrow_pos - 1] != ' ':
+ yield (idx + 1, "missing space before =>")
+ if arrow_pos + 2 < line_len and line[arrow_pos + 2] != ' ':
+ yield (idx + 1, "missing space after =>")
+ elif arrow_pos + 3 < line_len and line[arrow_pos + 3] == ' ':
+ yield (idx + 1, "extra space after =>")
+
# Avoid flagging ::crate::mod and `trait Foo : Bar`
match = line.find(" :")
if match != -1:
@@ -344,7 +354,7 @@ def check_rust(file_name, contents):
# check extern crates
if line.startswith("extern crate "):
crate_name = line[len("extern crate "):-1]
- indent = len(original_line) - len(line)
+ indent = len(original_line) - line_len
if indent not in prev_crate:
prev_crate[indent] = ""
if prev_crate[indent] > crate_name:
@@ -358,7 +368,7 @@ def check_rust(file_name, contents):
elif line.startswith("use "):
import_block = True
use = line[4:]
- indent = len(original_line) - len(line)
+ indent = len(original_line) - line_len
if not use.endswith(";"):
yield (idx + 1, "use statement spans multiple lines")
current_use = use[:len(use) - 1]
@@ -378,7 +388,7 @@ def check_rust(file_name, contents):
# modules must be in the same line and alphabetically sorted
if line.startswith("mod ") or line.startswith("pub mod "):
- indent = len(original_line) - len(line)
+ indent = len(original_line) - line_len
mod = line[4:] if line.startswith("mod ") else line[8:]
if idx < 0 or "#[macro_use]" not in contents[idx - 1]: