diff --git a/components/gfx/font.rs b/components/gfx/font.rs index ba11c2a63cc..74b6fbf4925 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -30,7 +30,7 @@ use util::geometry::Au; pub trait FontHandleMethods { fn new_from_template(fctx: &FontContextHandle, template: Arc, pt_size: Option) - -> Result; + -> Result; fn template(&self) -> Arc; fn family_name(&self) -> String; fn face_name(&self) -> String; diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index db14af662ec..1e5d3049550 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -167,7 +167,7 @@ impl ApplicableDeclarationsCache { /// An LRU cache of the last few nodes seen, so that we can aggressively try to reuse their styles. pub struct StyleSharingCandidateCache { - cache: LRUCache, + cache: LRUCache, } fn create_common_style_affecting_attributes_from_element(element: &LayoutElement) @@ -348,7 +348,7 @@ impl StyleSharingCandidateCache { } } - pub fn iter<'a>(&'a self) -> Iter<'a,(StyleSharingCandidate,())> { + pub fn iter<'a>(&'a self) -> Iter<'a, (StyleSharingCandidate, ())> { self.cache.iter() } diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index 2dfd4305c9d..13b93ad482f 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -40,7 +40,7 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: let trait_def = TraitDef { span: span, attributes: Vec::new(), - path: ty::Path::new(vec!("dom","bindings","trace","JSTraceable")), + path: ty::Path::new(vec!("dom", "bindings", "trace", "JSTraceable")), additional_bounds: Vec::new(), generics: ty::LifetimeBounds::empty(), methods: vec![ @@ -48,7 +48,7 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: name: "trace", generics: ty::LifetimeBounds::empty(), explicit_self: ty::borrowed_explicit_self(), - args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))), + args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js", "jsapi", "JSTracer"))), ty::Raw(ast::MutMutable))), ret_ty: ty::nil_ty(), attributes: vec![quote_attr!(cx, #[inline])], diff --git a/components/plugins/lints/ban.rs b/components/plugins/lints/ban.rs index 3be7f49a52b..70b81a70dd9 100644 --- a/components/plugins/lints/ban.rs +++ b/components/plugins/lints/ban.rs @@ -23,13 +23,13 @@ impl LintPass for BanPass { } fn check_ty(&mut self, cx: &Context, ty: &ast::Ty) { - if match_ty_unwrap(ty, &["std","cell","Cell"]) + if match_ty_unwrap(ty, &["std", "cell", "Cell"]) .and_then(|t| t.get(0)) .and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"])) .is_some() { cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell> detected. Use MutHeap> instead") } - if match_ty_unwrap(ty, &["std","cell","Cell"]) + if match_ty_unwrap(ty, &["std", "cell", "Cell"]) .and_then(|t| t.get(0)) .and_then(|t| match_ty_unwrap(&**t, &["js", "jsval", "JSVal"])) .is_some() { diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index 6ea7767bfab..fa0c070ceaf 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -60,7 +60,7 @@ impl DocumentLoader { /// are lots of iframes. pub fn new_with_task(resource_task: Arc, data: Option, - initial_load: Option,) + initial_load: Option) -> DocumentLoader { let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect(); diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 540cf744faf..893ad97b526 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -1153,7 +1153,7 @@ impl Drop for CanvasRenderingContext2D { } } -pub fn parse_color(string: &str) -> Result { +pub fn parse_color(string: &str) -> Result { let mut parser = Parser::new(&string); match CSSColor::parse(&mut parser) { Ok(CSSColor::RGBA(rgba)) => { diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 5ab625c1d48..4dd5647029a 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -1068,7 +1068,7 @@ impl XMLHttpRequest { fn fetch(&self, load_data: LoadData, - cors_request: Result,()>, + cors_request: Result, ()>, global: GlobalRef) -> ErrorResult { let cors_request = match cors_request { Err(_) => { diff --git a/components/script/textinput.rs b/components/script/textinput.rs index c647f63d4d8..8330b19f01f 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -158,7 +158,7 @@ impl TextInput { if begin.line != end.line { let mut s = String::new(); s.push_str(&self.lines[begin.line][begin.index..]); - for (_, line) in self.lines.iter().enumerate().filter(|&(i,_)| begin.line < i && i < end.line) { + for (_, line) in self.lines.iter().enumerate().filter(|&(i, _)| begin.line < i && i < end.line) { s.push_str("\n"); s.push_str(line); } diff --git a/components/style/values.rs b/components/style/values.rs index 2a5de980ed9..5f2b2771aab 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -826,7 +826,7 @@ pub mod specified { } /// Parses a time according to CSS-VALUES § 6.2. - fn parse_dimension(value: CSSFloat, unit: &str) -> Result { + fn parse_dimension(value: CSSFloat, unit: &str) -> Result { if unit.eq_ignore_ascii_case("s") { Ok(Time(value)) } else if unit.eq_ignore_ascii_case("ms") { @@ -836,7 +836,7 @@ pub mod specified { } } - pub fn parse(input: &mut Parser) -> Result { + pub fn parse(input: &mut Parser) -> Result { match input.next() { Ok(Token::Dimension(ref value, ref unit)) => { Time::parse_dimension(value.value, &unit) diff --git a/components/util/cache.rs b/components/util/cache.rs index fa1e32c9ba6..4bb02353702 100644 --- a/components/util/cache.rs +++ b/components/util/cache.rs @@ -76,7 +76,7 @@ impl LRUCache { self.entries[last_index].1.clone() } - pub fn iter<'a>(&'a self) -> Iter<'a,(K, V)> { + pub fn iter<'a>(&'a self) -> Iter<'a, (K, V)> { self.entries.iter() } diff --git a/components/util/ipc.rs b/components/util/ipc.rs index 7f8e0e82eda..32bbb8c14b7 100644 --- a/components/util/ipc.rs +++ b/components/util/ipc.rs @@ -26,7 +26,7 @@ pub enum OptionalIpcSender where T: Deserialize + Serialize + Send + Any { } impl OptionalIpcSender where T: Deserialize + Serialize + Send + Any { - pub fn send(&self, value: T) -> Result<(),()> { + pub fn send(&self, value: T) -> Result<(), ()> { match *self { OptionalIpcSender::OutOfProcess(ref ipc_sender) => ipc_sender.send(value), OptionalIpcSender::InProcess(ref sender) => sender.send(value).map_err(|_| ()), diff --git a/components/util/opts.rs b/components/util/opts.rs index 8a8459f687c..08124b1ebb6 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -435,7 +435,7 @@ pub fn from_cmdline_args(args: &[String]) { opts.optflag("i", "nonincremental-layout", "Enable to turn off incremental layout."); opts.optflag("", "no-ssl", "Disables ssl certificate verification."); opts.optflagopt("", "userscripts", - "Uses userscripts in resources/user-agent-js, or a specified full path",""); + "Uses userscripts in resources/user-agent-js, or a specified full path", ""); opts.optmulti("", "user-stylesheet", "A user stylesheet to be added to every document", "file.css"); opts.optflag("z", "headless", "Headless mode"); diff --git a/components/util/str.rs b/components/util/str.rs index e0c9e2a2fad..c7e68d5549d 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -169,7 +169,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto { } /// Parses a legacy color per HTML5 § 2.4.6. If unparseable, `Err` is returned. -pub fn parse_legacy_color(mut input: &str) -> Result { +pub fn parse_legacy_color(mut input: &str) -> Result { // Steps 1 and 2. if input.is_empty() { return Err(()) @@ -277,7 +277,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result { alpha: 1.0, }); - fn hex(ch: char) -> Result { + fn hex(ch: char) -> Result { match ch { '0'...'9' => Ok((ch as u8) - b'0'), 'a'...'f' => Ok((ch as u8) - b'a' + 10), @@ -286,7 +286,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result { } } - fn hex_string(string: &[u8]) -> Result { + fn hex_string(string: &[u8]) -> Result { match string.len() { 0 => Err(()), 1 => hex(string[0] as char),