servo: Merge #9055 - Issue #9042: Report incorrect number of spaces around => in the style checker (from simartin:issue_9042); r=Wafflespeanut

Fixes https://github.com/servo/servo/issues/9042

Source-Repo: https://github.com/servo/servo
Source-Revision: f77c7928868469ef4f326a269147ae2aee6151ee
This commit is contained in:
Simon Martin 2015-12-24 10:26:48 +05:01
Родитель 2d152878a2
Коммит 6f8d33fe11
7 изменённых файлов: 48 добавлений и 38 удалений

Просмотреть файл

@ -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
};
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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(

Просмотреть файл

@ -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
});
}

Просмотреть файл

@ -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(),

Просмотреть файл

@ -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();

Просмотреть файл

@ -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]: