diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-01-19 08:33:48 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-01-19 08:33:48 -0700 |
commit | ee94b3e8bf659c847bda967700272f8f98fdb0cc (patch) | |
tree | b2eb4585705b7b71229647ed2d77289d00474f75 | |
parent | f3dfe04fa45bd723fac40d1452550d55240f80f8 (diff) | |
parent | 394f8163433559cea294cb4a4e335cc43ccde1fe (diff) | |
download | servo-ee94b3e8bf659c847bda967700272f8f98fdb0cc.tar.gz servo-ee94b3e8bf659c847bda967700272f8f98fdb0cc.zip |
auto merge of #4662 : Ms2ger/servo/overlong, r=larsbergstrom
The Rust style guide suggests 100, but we have too many violations in the
tree already. This check can be tightened over time.
-rw-r--r-- | components/devtools/protocol.rs | 4 | ||||
-rw-r--r-- | components/layout/fragment.rs | 23 | ||||
-rw-r--r-- | components/script/dom/element.rs | 4 | ||||
-rw-r--r-- | components/util/smallvec.rs | 21 | ||||
-rw-r--r-- | python/tidy.py | 9 |
5 files changed, 50 insertions, 11 deletions
diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs index be27eed2ec1..df9078c7bf1 100644 --- a/components/devtools/protocol.rs +++ b/components/devtools/protocol.rs @@ -2,7 +2,9 @@ * 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/. */ -/// Low-level wire protocol implementation. Currently only supports [JSON packets](https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets). +//! Low-level wire protocol implementation. Currently only supports +//! [JSON packets] +//! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets). use serialize::{json, Encodable}; use serialize::json::Json; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 521b000dfcf..8bad0a288b6 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1256,11 +1256,24 @@ impl Fragment { pub fn find_split_info_by_new_line(&self) -> Option<(SplitInfo, Option<SplitInfo>, Arc<Box<TextRun>> /* TODO(bjz): remove */)> { match self.specific { - SpecificFragmentInfo::Canvas(_) | SpecificFragmentInfo::Generic | SpecificFragmentInfo::Iframe(_) | SpecificFragmentInfo::Image(_) | SpecificFragmentInfo::Table | SpecificFragmentInfo::TableCell | - SpecificFragmentInfo::TableRow | SpecificFragmentInfo::TableWrapper => None, - SpecificFragmentInfo::TableColumn(_) => panic!("Table column fragments do not need to split"), - SpecificFragmentInfo::UnscannedText(_) => panic!("Unscanned text fragments should have been scanned by now!"), - SpecificFragmentInfo::InlineBlock(_) | SpecificFragmentInfo::InlineAbsoluteHypothetical(_) => { + SpecificFragmentInfo::Canvas(_) | + SpecificFragmentInfo::Generic | + SpecificFragmentInfo::Iframe(_) | + SpecificFragmentInfo::Image(_) | + SpecificFragmentInfo::Table | + SpecificFragmentInfo::TableCell | + SpecificFragmentInfo::TableRow | + SpecificFragmentInfo::TableWrapper => { + None + } + SpecificFragmentInfo::TableColumn(_) => { + panic!("Table column fragments do not need to split") + } + SpecificFragmentInfo::UnscannedText(_) => { + panic!("Unscanned text fragments should have been scanned by now!") + } + SpecificFragmentInfo::InlineBlock(_) | + SpecificFragmentInfo::InlineAbsoluteHypothetical(_) => { panic!("Inline blocks or inline absolute hypothetical fragments do not get split") } SpecificFragmentInfo::ScannedText(ref text_fragment_info) => { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 14f48f5f3b6..0735e19299f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -111,7 +111,9 @@ impl Element { create_element(name, prefix, document, creator) } - pub fn new_inherited(type_id: ElementTypeId, local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: JSRef<Document>) -> Element { + pub fn new_inherited(type_id: ElementTypeId, local_name: DOMString, + namespace: Namespace, prefix: Option<DOMString>, + document: JSRef<Document>) -> Element { Element { node: Node::new_inherited(NodeTypeId::Element(type_id), document), local_name: Atom::from_slice(local_name.as_slice()), diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs index 60e22f25a70..e92d3d3eeba 100644 --- a/components/util/smallvec.rs +++ b/components/util/smallvec.rs @@ -531,7 +531,10 @@ pub mod tests { let mut v = SmallVec16::new(); v.push("hello".into_string()); v.push("there".into_string()); - assert_eq!(v.as_slice(), vec!["hello".into_string(), "there".into_string()].as_slice()); + assert_eq!(v.as_slice(), vec![ + "hello".into_string(), + "there".into_string(), + ].as_slice()); } #[test] @@ -541,7 +544,12 @@ pub mod tests { v.push("there".into_string()); v.push("burma".into_string()); v.push("shave".into_string()); - assert_eq!(v.as_slice(), vec!["hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string()].as_slice()); + assert_eq!(v.as_slice(), vec![ + "hello".into_string(), + "there".into_string(), + "burma".into_string(), + "shave".into_string(), + ].as_slice()); } #[test] @@ -556,7 +564,14 @@ pub mod tests { v.push("burma".into_string()); v.push("shave".into_string()); assert_eq!(v.as_slice(), vec![ - "hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string(), "hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string(), + "hello".into_string(), + "there".into_string(), + "burma".into_string(), + "shave".into_string(), + "hello".into_string(), + "there".into_string(), + "burma".into_string(), + "shave".into_string(), ].as_slice()); } } diff --git a/python/tidy.py b/python/tidy.py index da930eea333..fc282aaa464 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -56,6 +56,13 @@ def check_license(contents): yield (1, "incorrect license") +def check_length(contents): + lines = contents.splitlines(True) + for idx, line in enumerate(lines): + if len(line) >= 160: + yield (idx + 1, "(much) overlong line") + + def check_whitespace(contents): lines = contents.splitlines(True) for idx, line in enumerate(lines): @@ -88,7 +95,7 @@ def scan(): all_files = collect_file_names(directories_to_check) files_to_check = filter(should_check, all_files) - checking_functions = [check_license, check_whitespace] + checking_functions = [check_license, check_length, check_whitespace] errors = collect_errors_for_files(files_to_check, checking_functions) errors = list(errors) |