Auto merge of #16495 - coalman:tidy-brace-alignment, r=emilio

Make tidy check that opening and closing braces that begin a line do …

…so with proper alignment.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes fix #16486 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16495)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-19 03:06:31 -05:00 committed by GitHub
commit 195100f3ca
22 changed files with 150 additions and 130 deletions

View file

@ -365,7 +365,7 @@ impl NetworkEventActor {
RawStatus(s, Cow::from(status_text))
});
self.response.body = response.body.clone();
}
}
pub fn event_actor(&self) -> EventActor {
// TODO: Send the correct values for startedDateTime, isXHR, private
@ -413,7 +413,7 @@ impl NetworkEventActor {
transferredSize: 0,
discardResponseBody: true,
}
}
}
pub fn response_cookies(&self) -> ResponseCookiesMsg {
let mut cookies_size = 0;

View file

@ -113,7 +113,7 @@ impl HstsList {
fn has_subdomain(&self, host: &str, base_domain: &str) -> bool {
self.entries_map.get(base_domain).map_or(false, |entries| {
entries.iter().any(|e| e.matches_subdomain(host))
entries.iter().any(|e| e.matches_subdomain(host))
})
}

View file

@ -815,7 +815,7 @@ impl ByteMatcher {
mask: b"\xFF\xFF\xDF\xDF\xDF\xDF\xDF\xDF\xDF\xFF\xDF\xDF\xDF\xDF",
content_type: (TopLevel::Text, "html"),
leading_ignore: b"\t\n\x0C\r "
}
}
}
}

View file

@ -728,7 +728,7 @@ impl<T: JSTraceable> RootableVec<T> {
RootableVec {
v: vec![],
}
}
}
}
/// A vector of items that are rooted for the lifetime 'a.

View file

@ -353,12 +353,12 @@ pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()>
impl BlobMethods for Blob {
// https://w3c.github.io/FileAPI/#dfn-size
fn Size(&self) -> u64 {
match *self.blob_impl.borrow() {
BlobImpl::File(ref f) => f.size,
BlobImpl::Memory(ref v) => v.len() as u64,
BlobImpl::Sliced(ref parent, ref rel_pos) =>
rel_pos.to_abs_range(parent.Size() as usize).len() as u64,
}
match *self.blob_impl.borrow() {
BlobImpl::File(ref f) => f.size,
BlobImpl::Memory(ref v) => v.len() as u64,
BlobImpl::Sliced(ref parent, ref rel_pos) =>
rel_pos.to_abs_range(parent.Size() as usize).len() as u64,
}
}
// https://w3c.github.io/FileAPI/#dfn-type

View file

@ -37,7 +37,7 @@ impl DOMMatrixReadOnly {
reflector_: Reflector::new(),
matrix: DOMRefCell::new(matrix),
is2D: Cell::new(is2D),
}
}
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly

View file

@ -2599,7 +2599,7 @@ impl Element {
self.has_attribute(&local_name!("href"))
},
_ => false,
}
}
}
/// Please call this method *only* for real click events

View file

@ -2383,7 +2383,7 @@ impl NodeMethods for Node {
// Step 2.
Node::namespace_to_string(Node::locate_namespace(self, prefix))
}
}
// https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
fn IsDefaultNamespace(&self, namespace: Option<DOMString>) -> bool {

View file

@ -457,7 +457,7 @@ impl<'a> Iterator for &'a TreeWalker {
// will probably be using a native Rust filter,
// which cannot produce an Err result.
unreachable!()
}
}
}
}

View file

@ -1795,7 +1795,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
self.webgl_error(InvalidValue);
return None;
}
}
};
match program.get_active_uniform(index) {
@ -1822,7 +1822,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
self.webgl_error(InvalidValue);
return None;
}
}
};
match program.get_active_attrib(index) {

View file

@ -22,28 +22,28 @@ pub struct CSSErrorReporter {
}
impl ParseErrorReporter for CSSErrorReporter {
fn report_error(&self,
input: &mut Parser,
position: SourcePosition,
message: &str,
url: &ServoUrl,
line_number_offset: u64) {
fn report_error(&self,
input: &mut Parser,
position: SourcePosition,
message: &str,
url: &ServoUrl,
line_number_offset: u64) {
let location = input.source_location(position);
let line_offset = location.line + line_number_offset as usize;
if log_enabled!(log::LogLevel::Info) {
info!("Url:\t{}\n{}:{} {}",
url.as_str(),
line_offset,
location.column,
message)
info!("Url:\t{}\n{}:{} {}",
url.as_str(),
line_offset,
location.column,
message)
}
//TODO: report a real filename
let _ = self.script_chan.lock().unwrap().send(
ConstellationControlMsg::ReportCSSError(self.pipelineid,
"".to_owned(),
location.line,
location.column,
message.to_owned()));
}
//TODO: report a real filename
let _ = self.script_chan.lock().unwrap().send(
ConstellationControlMsg::ReportCSSError(self.pipelineid,
"".to_owned(),
location.line,
location.column,
message.to_owned()));
}
}

View file

@ -530,7 +530,7 @@ impl<Impl: SelectorImpl> ToCss for SimpleSelector<Impl> {
attr_selector_to_css(a, " = ", v, match case {
CaseSensitivity::CaseSensitive => None,
CaseSensitivity::CaseInsensitive => Some(" i"),
}, dest)
}, dest)
}
AttrDashMatch(ref a, ref v) => attr_selector_to_css(a, " |= ", v, None, dest),
AttrIncludesNeverMatch(ref a, ref v) |

View file

@ -381,7 +381,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
// [1]: https://drafts.csswg.org/css-transitions/#starting
if possibly_expired_animations.iter().any(|animation| {
animation.has_the_same_end_value_as(&property_animation)
}) {
}) {
continue
}

View file

@ -160,8 +160,8 @@ impl AttrValue {
pub fn from_comma_separated_tokenlist(tokens: String) -> AttrValue {
let atoms = split_commas(&tokens).map(Atom::from)
.fold(vec![], |mut acc, atom| {
if !acc.contains(&atom) { acc.push(atom) }
acc
if !acc.contains(&atom) { acc.push(atom) }
acc
});
AttrValue::TokenList(tokens, atoms)
}

View file

@ -1022,7 +1022,7 @@ impl ToCss for CalcLengthOrPercentage {
}
write!(dest, ")")
}
}
}
/// A percentage value.

View file

@ -554,7 +554,7 @@ impl HasViewportPercentage for BorderWidth {
match *self {
BorderWidth::Thin | BorderWidth::Medium | BorderWidth::Thick => false,
BorderWidth::Width(ref length) => length.has_viewport_percentage()
}
}
}
}

View file

@ -95,7 +95,7 @@ pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
match server::start(SocketAddr::V4(address), handler, &extension_routes()) {
Ok(listening) => info!("WebDriver server listening on {}", listening.socket),
Err(_) => panic!("Unable to start WebDriver HTTPD server"),
}
}
}).expect("Thread spawning failed");
}