diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 462d5bf485cd..426068a41060 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -576,13 +576,13 @@ extern fn glyph_h_advance_func(_: *mut hb_font_t, fn glyph_space_advance(font: *mut Font) -> f64 { let space_unicode = ' '; let space_glyph: hb_codepoint_t; - match unsafe {(*font).glyph_index(space_unicode)} { + match unsafe { (*font).glyph_index(space_unicode) } { Some(g) => { space_glyph = g as hb_codepoint_t; } None => panic!("No space info") } - let space_advance = unsafe {(*font).glyph_h_advance(space_glyph as GlyphId)}; + let space_advance = unsafe { (*font).glyph_h_advance(space_glyph as GlyphId) }; space_advance } diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs index 79025c33f70a..e26cc4bc7cd1 100644 --- a/components/plugins/utils.rs +++ b/components/plugins/utils.rs @@ -17,14 +17,14 @@ use syntax::ptr::P; /// Try not to use this for types defined in crates you own, use match_lang_ty instead (for lint passes) pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P]> { match ty.node { - TyPath(_, Path {segments: ref seg, ..}) => { + TyPath(_, Path { segments: ref seg, .. }) => { // So ast::Path isn't the full path, just the tokens that were provided. // I could muck around with the maps and find the full path // however the more efficient way is to simply reverse the iterators and zip them // which will compare them in reverse until one of them runs out of segments if seg.iter().rev().zip(segments.iter().rev()).all(|(a, b)| a.identifier.name.as_str() == *b) { match seg.last() { - Some(&PathSegment {parameters: AngleBracketedParameters(ref a), ..}) => { + Some(&PathSegment { parameters: AngleBracketedParameters(ref a), .. }) => { Some(&a.types) } _ => None diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 83b7c24ed3a0..4e03dff40868 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1867,10 +1867,10 @@ impl Element { } } // Step 6 - None => {event.fire(target);} + None => { event.fire(target); } }, // Step 6 - None => {event.fire(target);} + None => { event.fire(target); } } // Step 7 self.set_click_in_progress(false); diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 6aee8645ad8c..ad16e70afa20 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -64,7 +64,7 @@ impl HTMLCollection { } } } - let filter = AllElementFilter {namespace_filter: namespace_filter}; + let filter = AllElementFilter { namespace_filter: namespace_filter }; HTMLCollection::create(window, root, box filter) } diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index 88a369606aee..b715330edae0 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -52,9 +52,9 @@ impl ProgressEvent { type_: DOMString, init: &ProgressEventBinding::ProgressEventInit) -> Fallible> { - let bubbles = if init.parent.bubbles {EventBubbles::Bubbles} else {EventBubbles::DoesNotBubble}; - let cancelable = if init.parent.cancelable {EventCancelable::Cancelable} - else {EventCancelable::NotCancelable}; + let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; + let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } + else { EventCancelable::NotCancelable }; let ev = ProgressEvent::new(global, type_, bubbles, cancelable, init.lengthComputable, init.loaded, init.total); Ok(ev) diff --git a/components/script/dom/testbindingproxy.rs b/components/script/dom/testbindingproxy.rs index 3c1f23c8ae15..5ca27eae735c 100644 --- a/components/script/dom/testbindingproxy.rs +++ b/components/script/dom/testbindingproxy.rs @@ -15,20 +15,20 @@ pub struct TestBindingProxy { } impl TestBindingProxyMethods for TestBindingProxy { - fn Length(&self) -> u32 {0} - fn SupportedPropertyNames(&self) -> Vec {vec![]} - fn GetNamedItem(&self, _: DOMString) -> DOMString {"".to_owned()} + fn Length(&self) -> u32 { 0 } + fn SupportedPropertyNames(&self) -> Vec { vec![] } + fn GetNamedItem(&self, _: DOMString) -> DOMString { "".to_owned() } fn SetNamedItem(&self, _: DOMString, _: DOMString) -> () {} - fn GetItem(&self, _: u32) -> DOMString {"".to_owned()} + fn GetItem(&self, _: u32) -> DOMString { "".to_owned() } fn SetItem(&self, _: u32, _: DOMString) -> () {} fn RemoveItem(&self, _: DOMString) -> () {} - fn Stringifier(&self) -> DOMString {"".to_owned()} + fn Stringifier(&self) -> DOMString { "".to_owned() } fn NamedCreator(&self, _: DOMString, _: DOMString) -> () {} - fn IndexedGetter(&self, _: u32, _: &mut bool) -> DOMString {"".to_owned()} + fn IndexedGetter(&self, _: u32, _: &mut bool) -> DOMString { "".to_owned() } fn NamedDeleter(&self, _: DOMString) -> () {} fn IndexedSetter(&self, _: u32, _: DOMString) -> () {} fn NamedSetter(&self, _: DOMString, _: DOMString) -> () {} fn IndexedCreator(&self, _: u32, _: DOMString) -> () {} - fn NamedGetter(&self, _: DOMString, _: &mut bool) -> DOMString {"".to_owned()} + fn NamedGetter(&self, _: DOMString, _: &mut bool) -> DOMString { "".to_owned() } } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 1d7a097fd9ee..0f08ef9ec111 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -959,7 +959,7 @@ impl XMLHttpRequest { fn dispatch_response_progress_event(&self, type_: DOMString) { let len = self.response.borrow().len() as u64; - let total = self.response_headers.borrow().get::().map(|x| {**x as u64}); + let total = self.response_headers.borrow().get::().map(|x| { **x as u64 }); self.dispatch_progress_event(false, type_, len, total); } fn set_timeout(&self, duration_ms: u32) { diff --git a/components/script/timers.rs b/components/script/timers.rs index f18b2231417b..8fd712e7ac6d 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -183,7 +183,7 @@ impl TimerManager { if is_interval == IsInterval::NonInterval { break; } - } else if id == control_handle.id() {; + } else if id == control_handle.id() { match control_port.recv().unwrap() { TimerControlMsg::Suspend => { let msg = control_port.recv().unwrap(); @@ -194,7 +194,7 @@ impl TimerManager { break; }, } - }, + }, TimerControlMsg::Resume => panic!("Nothing to resume!"), TimerControlMsg::Cancel => { break; diff --git a/python/tidy.py b/python/tidy.py index 9ea9de24f304..990d0f161a15 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -243,6 +243,16 @@ def is_associated_type(match, line, index): if match: yield (idx + 1, "missing space before {") + # ignored cases like {} and }} + match = re.search(r"[^\s{}]}", line) + if match and not (line.startswith("use") or line.startswith("pub use")): + yield (idx + 1, "missing space before }") + + # ignored cases like {} and {{ + match = re.search(r"{[^\s{}]", line) + if match and not (line.startswith("use") or line.startswith("pub use")): + yield (idx + 1, "missing space after {") + # imports must be in the same line and alphabetically sorted if line.startswith("use "): use = line[4:] diff --git a/tests/unit/net/http_loader.rs b/tests/unit/net/http_loader.rs index 7d805f27d245..f007522b4338 100644 --- a/tests/unit/net/http_loader.rs +++ b/tests/unit/net/http_loader.rs @@ -199,7 +199,7 @@ impl AssertMustHaveBodyRequest { impl HttpRequest for AssertMustHaveBodyRequest { type R = MockResponse; - fn headers_mut(&mut self) -> &mut Headers { &mut self.headers} + fn headers_mut(&mut self) -> &mut Headers { &mut self.headers } fn send(self, body: &Option>) -> Result { assert_eq!(self.expected_body, *body);