diff options
author | Corey Farwell <coreyf@rwell.org> | 2015-10-12 19:40:48 -0400 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2015-10-12 20:21:49 -0400 |
commit | 20beaf5af31cb58c112cedc6bd4a2f4b89196da4 (patch) | |
tree | f2628f82f068194739b33d763b462a4da5690675 | |
parent | 6303126e0c48e9c83aa7edd813079a6a360837b2 (diff) | |
download | servo-20beaf5af31cb58c112cedc6bd4a2f4b89196da4.tar.gz servo-20beaf5af31cb58c112cedc6bd4a2f4b89196da4.zip |
Fix issues found by rust-clippy
-rw-r--r-- | components/canvas/canvas_paint_task.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/macos/font.rs | 4 | ||||
-rw-r--r-- | components/layout/fragment.rs | 6 | ||||
-rw-r--r-- | components/layout/generated_content.rs | 8 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 2 | ||||
-rw-r--r-- | components/net/cookie.rs | 2 | ||||
-rw-r--r-- | components/net/http_loader.rs | 11 | ||||
-rw-r--r-- | components/net/resource_task.rs | 4 | ||||
-rw-r--r-- | components/profile/mem.rs | 13 | ||||
-rw-r--r-- | components/profile/time.rs | 25 | ||||
-rw-r--r-- | components/profile_traits/time.rs | 2 | ||||
-rw-r--r-- | components/style/viewport.rs | 8 | ||||
-rw-r--r-- | components/util/cache.rs | 2 | ||||
-rw-r--r-- | components/util/cursor.rs | 4 | ||||
-rw-r--r-- | components/util/deque/mod.rs | 12 | ||||
-rw-r--r-- | components/util/mem.rs | 50 | ||||
-rw-r--r-- | components/util/opts.rs | 2 | ||||
-rw-r--r-- | components/util/persistent_list.rs | 3 | ||||
-rw-r--r-- | components/util/prefs.rs | 22 | ||||
-rw-r--r-- | components/util/str.rs | 7 | ||||
-rw-r--r-- | components/util/vec.rs | 2 | ||||
-rw-r--r-- | components/util/workqueue.rs | 8 | ||||
-rw-r--r-- | components/webdriver_server/lib.rs | 28 |
23 files changed, 106 insertions, 121 deletions
diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index dadc37aefd1..4244e27d6af 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -756,7 +756,7 @@ fn is_zero_size_gradient(pattern: &Pattern) -> bool { return true; } } - return false; + false } pub trait PointToi32 { diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index f316dd4d985..c9e464a0eb2 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle { let max_advance_width = au_from_pt(bounding_rect.size.width as f64); let average_advance = self.glyph_index('0') .and_then(|idx| self.glyph_h_advance(idx)) - .map(|advance| Au::from_f64_px(advance)) + .map(Au::from_f64_px) .unwrap_or(max_advance_width); let metrics = FontMetrics { @@ -201,7 +201,7 @@ impl FontHandleMethods for FontHandle { line_gap: Au::from_f64_px(line_gap), }; debug!("Font metrics (@{} pt): {:?}", self.ctfont.pt_size() as f64, metrics); - return metrics; + metrics } fn table_for_tag(&self, tag: FontTableTag) -> Option<Box<FontTable>> { diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 06a26863cff..cd05ff04572 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1479,7 +1479,7 @@ impl Fragment { let character_breaking_strategy = text_fragment_info.run.character_slices_in_range(&text_fragment_info.range); flags.remove(RETRY_AT_CHARACTER_BOUNDARIES); - return self.calculate_split_position_using_breaking_strategy( + self.calculate_split_position_using_breaking_strategy( character_breaking_strategy, max_inline_size, flags) @@ -1685,7 +1685,7 @@ impl Fragment { /// Assigns replaced inline-size, padding, and margins for this fragment only if it is replaced /// content per CSS 2.1 § 10.3.2. - pub fn assign_replaced_inline_size_if_necessary<'a>(&'a mut self, container_inline_size: Au) { + pub fn assign_replaced_inline_size_if_necessary(&mut self, container_inline_size: Au) { match self.specific { SpecificFragmentInfo::Generic | SpecificFragmentInfo::GeneratedContent(_) | @@ -2257,7 +2257,7 @@ impl Fragment { CharIndex(leading_whitespace_character_count), -CharIndex(leading_whitespace_character_count)); - return WhitespaceStrippingResult::RetainFragment + WhitespaceStrippingResult::RetainFragment } SpecificFragmentInfo::UnscannedText(ref mut unscanned_text_fragment_info) => { let mut new_text_string = String::new(); diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 2d43e596bce..686d9ec3920 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -184,11 +184,11 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> { } GeneratedContentInfo::ContentItem(ContentItem::Counter(ref counter_name, counter_style)) => { - let mut temporary_counter = Counter::new(); + let temporary_counter = Counter::new(); let counter = self.traversal .counters .get(&*counter_name) - .unwrap_or(&mut temporary_counter); + .unwrap_or(&temporary_counter); new_info = counter.render(self.traversal.layout_context, fragment.node, fragment.pseudo.clone(), @@ -199,11 +199,11 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> { GeneratedContentInfo::ContentItem(ContentItem::Counters(ref counter_name, ref separator, counter_style)) => { - let mut temporary_counter = Counter::new(); + let temporary_counter = Counter::new(); let counter = self.traversal .counters .get(&*counter_name) - .unwrap_or(&mut temporary_counter); + .unwrap_or(&temporary_counter); new_info = counter.render(self.traversal.layout_context, fragment.node, fragment.pseudo, diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index dbcea19abc8..a0ffd5d9549 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -1452,7 +1452,7 @@ impl LayoutTask { // Parallel mode. self.solve_constraints_parallel(parallel, &mut root_flow, - &mut *layout_context); + &*layout_context); } } }); diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 0bc77eae251..67e95661c77 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -154,7 +154,7 @@ impl Cookie { } } - if self.cookie.secure && url.scheme != "https".to_owned() { + if self.cookie.secure && url.scheme != "https" { return false; } if self.cookie.httponly && source == CookieSource::NonHTTP { diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 2be8ef0ab70..7713b7b3e73 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -75,10 +75,9 @@ fn send_error(url: Url, err: String, start_chan: LoadConsumer) { let mut metadata: Metadata = Metadata::default(url); metadata.status = None; - match start_sending_opt(start_chan, metadata) { - Ok(p) => p.send(Done(Err(err))).unwrap(), - _ => {} - }; + if let Ok(p) = start_sending_opt(start_chan, metadata) { + p.send(Done(Err(err))).unwrap(); + } } enum ReadResult { @@ -157,8 +156,8 @@ pub trait HttpResponse: Read { fn content_encoding(&self) -> Option<Encoding> { self.headers().get::<ContentEncoding>().and_then(|h| { - match h { - &ContentEncoding(ref encodings) => { + match *h { + ContentEncoding(ref encodings) => { if encodings.contains(&Encoding::Gzip) { Some(Encoding::Gzip) } else if encodings.contains(&Encoding::Deflate) { diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index 1631b5a8e7d..62dc75315db 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -173,7 +173,7 @@ impl ResourceChannelManager { self.resource_manager.set_cookies_for_url(request, cookie_list, source) } ControlMsg::GetCookiesForUrl(url, consumer, source) => { - let ref cookie_jar = self.resource_manager.cookie_storage; + let cookie_jar = &self.resource_manager.cookie_storage; let mut cookie_jar = cookie_jar.write().unwrap(); consumer.send(cookie_jar.cookies_for_url(&url, source)).unwrap(); } @@ -215,7 +215,7 @@ impl ResourceManager { if let Ok(SetCookie(cookies)) = header { for bare_cookie in cookies { if let Some(cookie) = cookie::Cookie::new_wrapped(bare_cookie, &request, source) { - let ref cookie_jar = self.cookie_storage; + let cookie_jar = &self.cookie_storage; let mut cookie_jar = cookie_jar.write().unwrap(); cookie_jar.push(cookie, source); } diff --git a/components/profile/mem.rs b/components/profile/mem.rs index b0736ff961d..0bd91f7afed 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -74,15 +74,10 @@ impl Profiler { } pub fn start(&mut self) { - loop { - match self.port.recv() { - Ok(msg) => { - if !self.handle_msg(msg) { - break - } - } - _ => break - } + while let Ok(msg) = self.port.recv() { + if !self.handle_msg(msg) { + break + } } } diff --git a/components/profile/time.rs b/components/profile/time.rs index e3c38827012..43afb37ae17 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -22,9 +22,9 @@ pub trait Formattable { impl Formattable for Option<TimerMetadata> { fn format(&self) -> String { - match self { + match *self { // TODO(cgaebel): Center-align in the format strings as soon as rustc supports it. - &Some(ref meta) => { + Some(ref meta) => { let url = &*meta.url; let url = if url.len() > 30 { &url[..30] @@ -35,7 +35,7 @@ impl Formattable for Option<TimerMetadata> { let iframe = if meta.iframe { " yes" } else { " no " }; format!(" {:14} {:9} {:30}", incremental, iframe, url) }, - &None => + None => format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A") } } @@ -198,16 +198,10 @@ impl Profiler { } pub fn start(&mut self) { - loop { - let msg = self.port.recv(); - match msg { - Ok(msg) => { - if !self.handle_msg(msg) { - break - } - } - _ => break - } + while let Ok(msg) = self.port.recv() { + if !self.handle_msg(msg) { + break + } } } @@ -227,10 +221,9 @@ impl Profiler { let ms = (t.1 - t.0) as f64 / 1000000f64; self.find_or_insert(k, ms); }, - ProfilerMsg::Print => match self.last_msg { + ProfilerMsg::Print => if let Some(ProfilerMsg::Time(..)) = self.last_msg { // only print if more data has arrived since the last printout - Some(ProfilerMsg::Time(..)) => self.print_buckets(), - _ => () + self.print_buckets(); }, ProfilerMsg::Exit => { heartbeats::cleanup(); diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs index 681c171d449..4056ee295d9 100644 --- a/components/profile_traits/time.rs +++ b/components/profile_traits/time.rs @@ -112,5 +112,5 @@ pub fn profile<T, F>(category: ProfilerCategory, profiler_chan.send(ProfilerMsg::Time((category, meta), (start_time, end_time), (start_energy, end_energy))); - return val; + val } diff --git a/components/style/viewport.rs b/components/style/viewport.rs index 3d3935ecb23..0dc10e70052 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.rs @@ -95,7 +95,7 @@ impl ViewportLength { } impl FromMeta for Zoom { - fn from_meta<'a>(value: &'a str) -> Option<Zoom> { + fn from_meta(value: &str) -> Option<Zoom> { Some(match value { v if v.eq_ignore_ascii_case("yes") => Zoom::Number(1.), v if v.eq_ignore_ascii_case("no") => Zoom::Number(0.1), @@ -113,7 +113,7 @@ impl FromMeta for Zoom { } impl FromMeta for UserZoom { - fn from_meta<'a>(value: &'a str) -> Option<UserZoom> { + fn from_meta(value: &str) -> Option<UserZoom> { Some(match value { v if v.eq_ignore_ascii_case("yes") => UserZoom::Zoom, v if v.eq_ignore_ascii_case("no") => UserZoom::Fixed, @@ -377,13 +377,13 @@ impl ViewportRule { start: usize) -> Option<(&'a str, &'a str)> { - fn end_of_token<'a>(iter: &mut Enumerate<Chars<'a>>) -> Option<(usize, char)> { + fn end_of_token(iter: &mut Enumerate<Chars>) -> Option<(usize, char)> { iter.by_ref() .skip_while(|&(_, c)| !is_whitespace_separator_or_equals(&c)) .next() } - fn skip_whitespace<'a>(iter: &mut Enumerate<Chars<'a>>) -> Option<(usize, char)> { + fn skip_whitespace(iter: &mut Enumerate<Chars>) -> Option<(usize, char)> { iter.by_ref() .skip_while(|&(_, c)| WHITESPACE.contains(&c)) .next() diff --git a/components/util/cache.rs b/components/util/cache.rs index 4bb02353702..7a3dcfa980f 100644 --- a/components/util/cache.rs +++ b/components/util/cache.rs @@ -76,7 +76,7 @@ impl<K: Clone + PartialEq, V: Clone> LRUCache<K, V> { self.entries[last_index].1.clone() } - pub fn iter<'a>(&'a self) -> Iter<'a, (K, V)> { + pub fn iter(&self) -> Iter<(K, V)> { self.entries.iter() } diff --git a/components/util/cursor.rs b/components/util/cursor.rs index 8e4ca9e3c1c..bda254861e2 100644 --- a/components/util/cursor.rs +++ b/components/util/cursor.rs @@ -26,8 +26,8 @@ macro_rules! define_cursor { impl ToCss for Cursor { fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write { - match self { - $( &Cursor::$variant => dest.write_str($css) ),+ + match *self { + $( Cursor::$variant => dest.write_str($css) ),+ } } } diff --git a/components/util/deque/mod.rs b/components/util/deque/mod.rs index 3764fbf933d..7ee26c9f2bf 100644 --- a/components/util/deque/mod.rs +++ b/components/util/deque/mod.rs @@ -197,7 +197,7 @@ impl<T: Send + 'static> Worker<T> { /// Gets access to the buffer pool that this worker is attached to. This can /// be used to create more deques which share the same buffer pool as this /// deque. - pub fn pool<'a>(&'a self) -> &'a BufferPool<T> { + pub fn pool(&self) -> &BufferPool<T> { &self.deque.pool } } @@ -211,7 +211,7 @@ impl<T: Send + 'static> Stealer<T> { /// Gets access to the buffer pool that this stealer is attached to. This /// can be used to create more deques which share the same buffer pool as /// this deque. - pub fn pool<'a>(&'a self) -> &'a BufferPool<T> { + pub fn pool(&self) -> &BufferPool<T> { &self.deque.pool } } @@ -270,11 +270,11 @@ impl<T: Send + 'static> Deque<T> { } if self.top.compare_and_swap(t, t + 1, SeqCst) == t { self.bottom.store(t + 1, SeqCst); - return Some(data); + Some(data) } else { self.bottom.store(t + 1, SeqCst); forget(data); // someone else stole this value - return None; + None } } @@ -325,7 +325,7 @@ impl<T: Send + 'static> Deque<T> { self.bottom.store(b, SeqCst); } self.pool.free(transmute(old)); - return newbuf; + newbuf } } @@ -393,7 +393,7 @@ impl<T> Buffer<T> { for i in t..b { buf.put(i, self.get(i)); } - return buf; + buf } } diff --git a/components/util/mem.rs b/components/util/mem.rs index 0243dd671b9..1577ff39dc2 100644 --- a/components/util/mem.rs +++ b/components/util/mem.rs @@ -123,9 +123,9 @@ impl HeapSizeOf for url::Url { impl HeapSizeOf for url::SchemeData { fn heap_size_of_children(&self) -> usize { - match self { - &url::SchemeData::Relative(ref data) => data.heap_size_of_children(), - &url::SchemeData::NonRelative(ref str) => str.heap_size_of_children() + match *self { + url::SchemeData::Relative(ref data) => data.heap_size_of_children(), + url::SchemeData::NonRelative(ref str) => str.heap_size_of_children() } } } @@ -147,9 +147,9 @@ impl HeapSizeOf for url::RelativeSchemeData { impl HeapSizeOf for url::Host { fn heap_size_of_children(&self) -> usize { - match self { - &url::Host::Domain(ref str) => str.heap_size_of_children(), - &url::Host::Ipv6(_) => 0 + match *self { + url::Host::Domain(ref str) => str.heap_size_of_children(), + url::Host::Ipv6(_) => 0 } } } @@ -302,8 +302,8 @@ impl<T: Copy + GCMethods<T>> HeapSizeOf for Heap<T> { impl HeapSizeOf for Method { fn heap_size_of_children(&self) -> usize { - match self { - &Method::Extension(ref str) => str.heap_size_of_children(), + match *self { + Method::Extension(ref str) => str.heap_size_of_children(), _ => 0 } } @@ -311,9 +311,9 @@ impl HeapSizeOf for Method { impl<T: HeapSizeOf, U: HeapSizeOf> HeapSizeOf for Result<T, U> { fn heap_size_of_children(&self) -> usize { - match self { - &Result::Ok(ref ok) => ok.heap_size_of_children(), - &Result::Err(ref err) => err.heap_size_of_children() + match *self { + Result::Ok(ref ok) => ok.heap_size_of_children(), + Result::Err(ref err) => err.heap_size_of_children() } } } @@ -341,13 +341,13 @@ impl HeapSizeOf for CompoundSelector { impl HeapSizeOf for SimpleSelector { fn heap_size_of_children(&self) -> usize { - match self { - &SimpleSelector::Negation(ref vec) => vec.heap_size_of_children(), - &SimpleSelector::AttrIncludes(_, ref str) | &SimpleSelector::AttrPrefixMatch(_, ref str) | - &SimpleSelector::AttrSubstringMatch(_, ref str) | &SimpleSelector::AttrSuffixMatch(_, ref str) + match *self { + SimpleSelector::Negation(ref vec) => vec.heap_size_of_children(), + SimpleSelector::AttrIncludes(_, ref str) | SimpleSelector::AttrPrefixMatch(_, ref str) | + SimpleSelector::AttrSubstringMatch(_, ref str) | SimpleSelector::AttrSuffixMatch(_, ref str) => str.heap_size_of_children(), - &SimpleSelector::AttrEqual(_, ref str, _) => str.heap_size_of_children(), - &SimpleSelector::AttrDashMatch(_, ref first, ref second) => first.heap_size_of_children() + SimpleSelector::AttrEqual(_, ref str, _) => str.heap_size_of_children(), + SimpleSelector::AttrDashMatch(_, ref first, ref second) => first.heap_size_of_children() + second.heap_size_of_children(), // All other types come down to Atom, enum or i32, all 0 _ => 0 @@ -372,8 +372,8 @@ impl HeapSizeOf for Mime { impl HeapSizeOf for TopLevel { fn heap_size_of_children(&self) -> usize { - match self { - &TopLevel::Ext(ref str) => str.heap_size_of_children(), + match *self { + TopLevel::Ext(ref str) => str.heap_size_of_children(), _ => 0 } } @@ -381,8 +381,8 @@ impl HeapSizeOf for TopLevel { impl HeapSizeOf for SubLevel { fn heap_size_of_children(&self) -> usize { - match self { - &SubLevel::Ext(ref str) => str.heap_size_of_children(), + match *self { + SubLevel::Ext(ref str) => str.heap_size_of_children(), _ => 0 } } @@ -390,8 +390,8 @@ impl HeapSizeOf for SubLevel { impl HeapSizeOf for Attr { fn heap_size_of_children(&self) -> usize { - match self { - &Attr::Ext(ref str) => str.heap_size_of_children(), + match *self { + Attr::Ext(ref str) => str.heap_size_of_children(), _ => 0 } } @@ -399,8 +399,8 @@ impl HeapSizeOf for Attr { impl HeapSizeOf for Value { fn heap_size_of_children(&self) -> usize { - match self { - &Value::Ext(ref str) => str.heap_size_of_children(), + match *self { + Value::Ext(ref str) => str.heap_size_of_children(), _ => 0 } } diff --git a/components/util/opts.rs b/components/util/opts.rs index d3b25743431..ea1d9609264 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -257,7 +257,7 @@ pub struct DebugOptions { impl DebugOptions { - pub fn new<'a>(debug_string: &'a str) -> Result<DebugOptions, &'a str> { + pub fn new(debug_string: &str) -> Result<DebugOptions, &str> { let mut debug_options = DebugOptions::default(); for option in debug_string.split(',') { diff --git a/components/util/persistent_list.rs b/components/util/persistent_list.rs index 9043fe76e54..210606f1d5d 100644 --- a/components/util/persistent_list.rs +++ b/components/util/persistent_list.rs @@ -49,7 +49,7 @@ impl<T> PersistentList<T> where T: Send + Sync { } #[inline] - pub fn iter<'a>(&'a self) -> PersistentListIterator<'a, T> { + pub fn iter(&self) -> PersistentListIterator<T> { // This could clone (and would not need the lifetime if it did), but then it would incur // atomic operations on every call to `.next()`. Bad. PersistentListIterator { @@ -90,4 +90,3 @@ impl<'a, T> Iterator for PersistentListIterator<'a, T> where T: Send + Sync + 's Some(value) } } - diff --git a/components/util/prefs.rs b/components/util/prefs.rs index 9762e1865af..b73bf9158d9 100644 --- a/components/util/prefs.rs +++ b/components/util/prefs.rs @@ -34,8 +34,8 @@ impl PrefValue { } pub fn as_boolean(&self) -> Option<bool> { - match self { - &PrefValue::Boolean(value) => { + match *self { + PrefValue::Boolean(value) => { Some(value) }, _ => None @@ -87,12 +87,12 @@ impl Pref { } pub fn value(&self) -> &Arc<PrefValue> { - match self { - &Pref::NoDefault(ref x) => x, - &Pref::WithDefault(ref default, ref override_value) => { - match override_value { - &Some(ref x) => x, - &None => default + match *self { + Pref::NoDefault(ref x) => x, + Pref::WithDefault(ref default, ref override_value) => { + match *override_value { + Some(ref x) => x, + None => default } } } @@ -101,11 +101,11 @@ impl Pref { fn set(&mut self, value: PrefValue) { // TODO - this should error if we try to override a pref of one type // with a value of a different type - match self { - &mut Pref::NoDefault(ref mut pref_value) => { + match *self { + Pref::NoDefault(ref mut pref_value) => { *pref_value = Arc::new(value) }, - &mut Pref::WithDefault(_, ref mut override_value) => { + Pref::WithDefault(_, ref mut override_value) => { *override_value = Some(Arc::new(value)) } } diff --git a/components/util/str.rs b/components/util/str.rs index ef84853493c..35f7ff4efcf 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -97,7 +97,7 @@ fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> { let value = read_numbers(input); - return value.and_then(|value| value.checked_mul(sign)); + value.and_then(|value| value.checked_mul(sign)) } /// Parse an integer according to @@ -244,9 +244,8 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA, ()> { } // Step 5. - match cssparser::parse_color_keyword(input) { - Ok(Color::RGBA(rgba)) => return Ok(rgba), - _ => {} + if let Ok(Color::RGBA(rgba)) = cssparser::parse_color_keyword(input) { + return Ok(rgba); } // Step 6. diff --git a/components/util/vec.rs b/components/util/vec.rs index 808aeb96479..ce4ac1f570a 100644 --- a/components/util/vec.rs +++ b/components/util/vec.rs @@ -52,7 +52,7 @@ impl<T> FullBinarySearchMethods<T> for [T] { Ordering::Equal => return Some(mid), } } - return None; + None } } diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs index af481312f21..26125335b3e 100644 --- a/components/util/workqueue.rs +++ b/components/util/workqueue.rs @@ -259,13 +259,13 @@ impl<QueueData: Sync, WorkData: Send> WorkQueue<QueueData, WorkData> { } // Connect workers to one another. - for i in 0..thread_count { - for j in 0..thread_count { + for (i, mut thread) in threads.iter_mut().enumerate() { + for (j, info) in infos.iter().enumerate() { if i != j { - threads[i].other_deques.push(infos[j].thief.clone()) + thread.other_deques.push(info.thief.clone()) } } - assert!(threads[i].other_deques.len() == thread_count - 1) + assert!(thread.other_deques.len() == thread_count - 1) } // Spawn threads. diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index c00f36c070a..497c827ea02 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -87,16 +87,16 @@ impl WebDriverExtensionRoute for ServoExtensionRoute { fn command(&self, _captures: &Captures, body_data: &Json) -> WebDriverResult<WebDriverCommand<ServoExtensionCommand>> { - let command = match self { - &ServoExtensionRoute::GetPrefs => { + let command = match *self { + ServoExtensionRoute::GetPrefs => { let parameters: GetPrefsParameters = try!(Parameters::from_json(&body_data)); ServoExtensionCommand::GetPrefs(parameters) } - &ServoExtensionRoute::SetPrefs => { + ServoExtensionRoute::SetPrefs => { let parameters: SetPrefsParameters = try!(Parameters::from_json(&body_data)); ServoExtensionCommand::SetPrefs(parameters) } - &ServoExtensionRoute::ResetPrefs => { + ServoExtensionRoute::ResetPrefs => { let parameters: GetPrefsParameters = try!(Parameters::from_json(&body_data)); ServoExtensionCommand::ResetPrefs(parameters) } @@ -114,10 +114,10 @@ enum ServoExtensionCommand { impl WebDriverExtensionCommand for ServoExtensionCommand { fn parameters_json(&self) -> Option<Json> { - match self { - &ServoExtensionCommand::GetPrefs(ref x) => Some(x.to_json()), - &ServoExtensionCommand::SetPrefs(ref x) => Some(x.to_json()), - &ServoExtensionCommand::ResetPrefs(ref x) => Some(x.to_json()), + match *self { + ServoExtensionCommand::GetPrefs(ref x) => Some(x.to_json()), + ServoExtensionCommand::SetPrefs(ref x) => Some(x.to_json()), + ServoExtensionCommand::ResetPrefs(ref x) => Some(x.to_json()), } } } @@ -541,8 +541,8 @@ impl Handler { "implicit" => self.implicit_wait_timeout = value, "page load" => self.load_timeout = value, "script" => self.script_timeout = value, - x @ _ => return Err(WebDriverError::new(ErrorStatus::InvalidSelector, - &format!("Unknown timeout type {}", x))) + x => return Err(WebDriverError::new(ErrorStatus::InvalidSelector, + &format!("Unknown timeout type {}", x))) } Ok(WebDriverResponse::Void) } @@ -705,10 +705,10 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler { WebDriverCommand::SetTimeouts(ref x) => self.handle_set_timeouts(x), WebDriverCommand::TakeScreenshot => self.handle_take_screenshot(), WebDriverCommand::Extension(ref extension) => { - match extension { - &ServoExtensionCommand::GetPrefs(ref x) => self.handle_get_prefs(x), - &ServoExtensionCommand::SetPrefs(ref x) => self.handle_set_prefs(x), - &ServoExtensionCommand::ResetPrefs(ref x) => self.handle_reset_prefs(x), + match *extension { + ServoExtensionCommand::GetPrefs(ref x) => self.handle_get_prefs(x), + ServoExtensionCommand::SetPrefs(ref x) => self.handle_set_prefs(x), + ServoExtensionCommand::ResetPrefs(ref x) => self.handle_reset_prefs(x), } } _ => Err(WebDriverError::new(ErrorStatus::UnsupportedOperation, |