diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 71e721f784d..6e15a5ab489 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -548,7 +548,6 @@ impl<'a> CanvasPaintThread<'a> { offset: Point2D, image_data_size: Size2D, mut dirty_rect: Rect) { - if image_data_size.width <= 0.0 || image_data_size.height <= 0.0 { return } diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 383a9a8d394..8dd94c51c71 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -929,7 +929,6 @@ impl Constellation debug!("Panic handler for pipeline {:?}: {}.", pipeline_id, reason); if let Some(pipeline_id) = pipeline_id { - let parent_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.parent_info); let window_size = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.size); @@ -1026,13 +1025,11 @@ impl Constellation // containing_page_pipeline_id's frame tree's children. This message is never the result of a // page navigation. fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) { - let old_pipeline_id = load_info.old_subpage_id .and_then(|old_subpage_id| self.subpage_map.get(&(load_info.containing_pipeline_id, old_subpage_id))) .cloned(); let (load_data, script_chan, window_size) = { - let old_pipeline = old_pipeline_id .and_then(|old_pipeline_id| self.pipelines.get(&old_pipeline_id)); @@ -1599,7 +1596,6 @@ impl Constellation } fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) { - // If the currently focused pipeline is the one being changed (or a child // of the pipeline being changed) then update the focus pipeline to be // the replacement. @@ -1804,7 +1800,6 @@ impl Constellation // are met, then the output image should not change and a reftest // screenshot can safely be written. for frame in self.current_frame_tree_iter(self.root_frame_id) { - let pipeline_id = frame.current; let pipeline = match self.pipelines.get(&pipeline_id) { @@ -2050,7 +2045,6 @@ impl Constellation // with low-resource scenarios. if let Some(root_frame_id) = self.root_frame_id { if let Some(frame_tree) = self.frame_to_sendable(root_frame_id) { - let (chan, port) = ipc::channel().expect("Failed to create IPC channel!"); self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree, chan, diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs index dd23accf1b5..a6282b71918 100644 --- a/components/devtools/actors/network_event.rs +++ b/components/devtools/actors/network_event.rs @@ -373,7 +373,6 @@ impl NetworkEventActor { } pub fn response_cookies(&self) -> ResponseCookiesMsg { - let mut cookies_size = 0; if let Some(ref headers) = self.response.headers { cookies_size = match headers.get() { @@ -387,7 +386,6 @@ impl NetworkEventActor { } pub fn response_headers(&self) -> ResponseHeadersMsg { - let mut headers_size = 0; let mut headers_byte_count = 0; if let Some(ref headers) = self.response.headers { @@ -404,7 +402,6 @@ impl NetworkEventActor { } pub fn request_cookies(&self) -> RequestCookiesMsg { - let mut cookies_size = 0; if let Some(ref headers) = self.response.headers { cookies_size = match headers.get() { diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index f25b820e378..91231d08a52 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -127,7 +127,6 @@ impl TimelineActor { pub fn new(name: String, pipeline: PipelineId, script_sender: IpcSender) -> TimelineActor { - let marker_types = vec!(TimelineMarkerType::Reflow, TimelineMarkerType::DOMEvent); @@ -270,7 +269,6 @@ impl Emitter { stream: TcpStream, memory_actor_name: Option, framerate_actor_name: Option) -> Emitter { - Emitter { from: name, stream: stream, diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index d8e54ddad62..a0d514f9025 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -387,7 +387,6 @@ fn run_server(sender: Sender, pipeline_id: PipelineId, request_id: String, network_event: NetworkEvent) { - let console_actor_name = match find_console_actor(actors.clone(), pipeline_id, None, actor_workers, actor_pipelines) { Some(name) => name, diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 091e9a08c5a..d7463c31124 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -422,7 +422,6 @@ impl DisplayList { traversal: &mut DisplayListTraversal<'a>, paint_context: &mut PaintContext, transform: &Matrix4D) { - if stacking_context.context_type != StackingContextType::Real { self.draw_stacking_context_contents(stacking_context, traversal, diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index f132bfc364b..a43490036b9 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -405,7 +405,6 @@ impl FontCacheThread { pub fn find_font_template(&self, family: FontFamily, desc: FontTemplateDescriptor) -> Option { - let (response_chan, response_port) = ipc::channel().unwrap(); self.chan.send(Command::GetFontTemplate(family, desc, response_chan)).unwrap(); @@ -420,7 +419,6 @@ impl FontCacheThread { pub fn last_resort_font_template(&self, desc: FontTemplateDescriptor) -> FontTemplateInfo { - let (response_chan, response_port) = ipc::channel().unwrap(); self.chan.send(Command::GetLastResortFontTemplate(desc, response_chan)).unwrap(); diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 3d4283c72df..71255e38c51 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -663,7 +663,6 @@ impl<'a> PaintContext<'a> { fn corner_bounds(bounds: &Rect, border: &SideOffsets2D, radii: &BorderRadii) -> (CornerOrigin, SideOffsets2D>) { - fn distance_to_elbow(radius: &Size2D, corner_width: f32, corner_height: f32) -> Size2D { @@ -1658,7 +1657,6 @@ pub trait ToAzureRect { } impl ToAzureRect for Rect { - /// Round rects to pixel coordinates, maintaining the invariant of non-overlap, /// assuming that before rounding rects don't overlap. fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor) -> Rect { diff --git a/components/layout/construct.rs b/components/layout/construct.rs index d08e8ad374c..8d37b6aa6ba 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -867,7 +867,6 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> splits, fragments: successors, })) => { - // Bubble up {ib} splits. self.accumulate_inline_block_splits(splits, node, diff --git a/components/layout/context.rs b/components/layout/context.rs index 9c752645513..81deafafa33 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -120,7 +120,6 @@ impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> { impl<'a> LayoutContext<'a> { pub fn new(shared_layout_context: &'a SharedLayoutContext) -> LayoutContext<'a> { - let local_context = create_or_get_local_context(shared_layout_context); LayoutContext { diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 50948ac411d..6d2a12fec62 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -108,7 +108,6 @@ impl FlexFlow { pub fn from_fragment(fragment: Fragment, flotation: Option) -> FlexFlow { - let (main_mode, is_reverse) = match fragment.style.get_position().flex_direction { flex_direction::T::row => (Mode::Inline, false), flex_direction::T::row_reverse => (Mode::Inline, true), diff --git a/components/layout/query.rs b/components/layout/query.rs index 2fae4974e25..7f2b7a44fb2 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -51,7 +51,6 @@ fn overflow_direction(writing_mode: &WritingMode) -> OverflowDirection { } impl LayoutRPC for LayoutRPCImpl { - // The neat thing here is that in order to answer the following two queries we only // need to compare nodes for equality. Thus we can safely work only with `OpaqueNode`. fn content_box(&self) -> ContentBoxResponse { diff --git a/components/layout/text.rs b/components/layout/text.rs index b2f08fff75b..e2d88e539f8 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -411,7 +411,6 @@ impl TextRunScanner { #[inline] fn bounding_box_for_run_metrics(metrics: &RunMetrics, writing_mode: WritingMode) -> LogicalSize { - // This does nothing, but it will fail to build // when more values are added to the `text-orientation` CSS property. // This will be a reminder to update the code below. diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 9d87c34ff52..24c78f190b7 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -982,7 +982,6 @@ impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> { } impl<'ln> DangerousThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { - unsafe fn dangerous_first_child(&self) -> Option { self.get_jsmanaged().first_child_ref() .map(|node| self.new_with_this_lifetime(&node)) diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index f6e83f79459..97861283606 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -77,7 +77,6 @@ fn match_headers(cors_cache: &CORSCacheEntry, cors_req: &Request) -> bool { pub struct CORSCache(Vec); impl CORSCache { - pub fn new() -> CORSCache { CORSCache(vec![]) } diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index db29995ff98..45ecbd1e603 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -47,7 +47,6 @@ pub fn fetch(request: Rc) -> Response { } pub fn fetch_with_cors_cache(request: Rc, cache: &mut CORSCache) -> Response { - // Step 1 if request.window.get() == Window::Client { // TODO: Set window to request's client object if client is a Window object @@ -63,9 +62,7 @@ pub fn fetch_with_cors_cache(request: Rc, cache: &mut CORSCache) -> Res // Step 3 if !request.headers.borrow().has::() { - let value = match request.type_ { - // Substep 2 _ if request.is_navigation_request() => vec![qitem(mime!(Text / Html)), @@ -163,7 +160,6 @@ fn main_fetch(request: Rc, cache: &mut CORSCache, cors_flag: bool, recu (current_url.scheme() == "file" && request.same_origin_data.get()) || current_url.scheme() == "about" || request.mode == RequestMode::Navigate { - basic_fetch(request.clone(), cache) } else if request.mode == RequestMode::SameOrigin { @@ -180,7 +176,6 @@ fn main_fetch(request: Rc, cache: &mut CORSCache, cors_flag: bool, recu (request.unsafe_request && (!is_simple_method(&request.method.borrow()) || request.headers.borrow().iter().any(|h| !is_simple_header(&h)))) { - request.response_tainting.set(ResponseTainting::CORSTainting); request.redirect_mode.set(RedirectMode::Error); let response = http_fetch(request.clone(), cache, true, true, false); @@ -289,11 +284,9 @@ fn main_fetch(request: Rc, cache: &mut CORSCache, cors_flag: bool, recu /// [Basic fetch](https://fetch.spec.whatwg.org#basic-fetch) fn basic_fetch(request: Rc, cache: &mut CORSCache) -> Response { - let url = request.current_url(); match url.scheme() { - "about" if url.path() == "blank" => { let mut response = Response::new(); response.headers.set(ContentType(mime!(Text / Html; Charset = Utf8))); @@ -358,7 +351,6 @@ fn http_fetch(request: Rc, cors_flag: bool, cors_preflight_flag: bool, authentication_fetch_flag: bool) -> Response { - // Step 1 let mut response: Option = None; @@ -367,12 +359,10 @@ fn http_fetch(request: Rc, // Step 3 if !request.skip_service_worker.get() && !request.is_service_worker_global_scope { - // Substep 1 // TODO (handle fetch unimplemented) if let Some(ref res) = response { - // Substep 2 // nothing to do, since actual_response is a function on response @@ -400,7 +390,6 @@ fn http_fetch(request: Rc, // Step 4 if response.is_none() { - // Substep 1 if cors_preflight_flag { let method_cache_match = cache.match_method(&*request, @@ -450,11 +439,9 @@ fn http_fetch(request: Rc, // Step 5 match response.actual_response().status.unwrap() { - // Code 301, 302, 303, 307, 308 StatusCode::MovedPermanently | StatusCode::Found | StatusCode::SeeOther | StatusCode::TemporaryRedirect | StatusCode::PermanentRedirect => { - response = match request.redirect_mode.get() { RedirectMode::Error => Response::network_error(), RedirectMode::Manual => { @@ -470,7 +457,6 @@ fn http_fetch(request: Rc, // Code 401 StatusCode::Unauthorized => { - // Step 1 // FIXME: Figure out what to do with request window objects if cors_flag || request.credentials_mode != CredentialsMode::Include { @@ -491,7 +477,6 @@ fn http_fetch(request: Rc, // Code 407 StatusCode::ProxyAuthenticationRequired => { - // Step 1 // TODO: Figure out what to do with request window objects @@ -526,7 +511,6 @@ fn http_redirect_fetch(request: Rc, cache: &mut CORSCache, response: Rc, cors_flag: bool) -> Response { - // Step 1 assert_eq!(response.return_internal.get(), true); @@ -592,7 +576,6 @@ fn http_redirect_fetch(request: Rc, if ((status_code == StatusCode::MovedPermanently || status_code == StatusCode::Found) && *request.method.borrow() == Method::Post) || status_code == StatusCode::SeeOther { - *request.method.borrow_mut() = Method::Get; *request.body.borrow_mut() = None; } @@ -608,7 +591,6 @@ fn http_redirect_fetch(request: Rc, fn http_network_or_cache_fetch(request: Rc, credentials_flag: bool, authentication_fetch_flag: bool) -> Response { - // TODO: Implement Window enum for Request let request_has_no_window = true; @@ -662,7 +644,6 @@ fn http_network_or_cache_fetch(request: Rc, } match http_request.cache_mode.get() { - // Step 9 CacheMode::Default if is_no_store_cache(&http_request.headers.borrow()) => { http_request.cache_mode.set(CacheMode::NoStore); @@ -695,13 +676,11 @@ fn http_network_or_cache_fetch(request: Rc, // Step 13 // TODO some of this step can't be implemented yet if credentials_flag { - // Substep 1 // TODO http://mxr.mozilla.org/servo/source/components/net/http_loader.rs#504 // Substep 2 if !http_request.headers.borrow().has::>() { - // Substep 3 let mut authorization_value = None; @@ -710,7 +689,6 @@ fn http_network_or_cache_fetch(request: Rc, // Substep 5 if authentication_fetch_flag { - let current_url = http_request.current_url(); authorization_value = if has_credentials(¤t_url) { @@ -742,7 +720,6 @@ fn http_network_or_cache_fetch(request: Rc, if http_request.cache_mode.get() != CacheMode::NoStore && http_request.cache_mode.get() != CacheMode::Reload && complete_http_response_from_cache.is_some() { - // Substep 1 if http_request.cache_mode.get() == CacheMode::ForceCache { // TODO pull response from HTTP cache @@ -764,7 +741,6 @@ fn http_network_or_cache_fetch(request: Rc, // Substep 3 if revalidation_needed && http_request.cache_mode.get() == CacheMode::Default || http_request.cache_mode.get() == CacheMode::NoCache { - // TODO this substep } @@ -786,7 +762,6 @@ fn http_network_or_cache_fetch(request: Rc, if status == StatusCode::NotModified && (http_request.cache_mode.get() == CacheMode::Default || http_request.cache_mode.get() == CacheMode::NoCache) { - // Substep 1 // TODO this substep // let cached_response: Option = None; @@ -848,7 +823,6 @@ fn http_network_fetch(request: Rc, let res_body = response.body.clone(); thread::spawn(move || { - *res_body.lock().unwrap() = ResponseBody::Receiving(vec![]); loop { @@ -892,11 +866,9 @@ fn http_network_fetch(request: Rc, // TODO this step if let Some(encoding) = response.headers.get::() { if encoding.contains(&Encoding::Gzip) { - } else if encoding.contains(&Encoding::Compress) { - } }; @@ -1027,7 +999,6 @@ fn cors_preflight_fetch(request: Rc, cache: &mut CORSCache) -> Response /// [CORS check](https://fetch.spec.whatwg.org#concept-cors-check) fn cors_check(request: Rc, response: &Response) -> Result<(), ()> { - // Step 1 let origin = response.headers.get::().cloned(); diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs index bf546c80636..4fb4eea3fd9 100644 --- a/components/net/filemanager_thread.rs +++ b/components/net/filemanager_thread.rs @@ -132,7 +132,6 @@ impl FileManager { } fn read_file(&mut self, sender: IpcSender>>, id: Uuid) { - match self.idmap.borrow().get(&id).and_then(|filepath| { let mut buffer = vec![]; match File::open(&filepath) { diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 7dd5fc3c193..4c73b91593c 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -124,7 +124,6 @@ fn load_for_consumer(load_data: LoadData, devtools_chan: Option>, cancel_listener: CancellationListener, user_agent: String) { - let factory = NetworkHttpRequestFactory { connector: connector, }; @@ -555,7 +554,6 @@ fn send_request_to_devtools(devtools_chan: Option>, headers: Headers, body: Option>, pipeline_id: PipelineId, now: Tm) { - if let Some(ref chan) = devtools_chan { let request = DevtoolsHttpRequest { url: url, method: method, headers: headers, body: body, pipeline_id: pipeline_id, startedDateTime: now }; @@ -632,7 +630,6 @@ pub fn modify_request_headers(headers: &mut Headers, fn set_auth_header(headers: &mut Headers, url: &Url, auth_cache: &Arc>) { - if !headers.has::>() { if let Some(auth) = auth_from_url(url) { headers.set(auth); @@ -694,7 +691,6 @@ pub fn obtain_response(request_factory: &HttpRequestFactory, devtools_chan: &Option>, request_id: &str) -> Result where A: HttpRequest + 'static { - let null_data = None; let response; let connection_url = replace_hosts(&url); diff --git a/components/net/mime_classifier.rs b/components/net/mime_classifier.rs index e9bc4ed4f4f..6107130d387 100644 --- a/components/net/mime_classifier.rs +++ b/components/net/mime_classifier.rs @@ -266,7 +266,6 @@ trait Matches { } impl <'a, T: Iterator + Clone> Matches for T { - // Matching function that works on an iterator. // see if the next matches.len() bytes in data_iterator equal matches // move iterator and return true or just return false @@ -587,7 +586,6 @@ struct FeedsClassifier; impl FeedsClassifier { // Implements sniffing for mislabeled feeds (https://mimesniff.spec.whatwg.org/#sniffing-a-mislabeled-feed) fn classify_impl(&self, data: &[u8]) -> Option<(&'static str, &'static str)> { - // Step 4: can not be feed unless length is > 3 if data.len() < 3 { return None; @@ -603,7 +601,6 @@ impl FeedsClassifier { // TODO: need max_bytes to prevent inadvertently examining html document // eg. an html page with a feed example loop { - if matcher.find(|&x| *x == b'<').is_none() { return None; } diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 76d44fd704a..fe5bc48be78 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -234,7 +234,6 @@ impl ResourceChannelManager { } pub fn read_json_from_file(data: &mut T, config_dir: &str, filename: &str) { - let path = Path::new(config_dir).join(filename); let display = path.display(); @@ -262,7 +261,6 @@ pub fn read_json_from_file(data: &mut T, config_dir: &str, filenam } pub fn write_json_to_file(data: &T, config_dir: &str, filename: &str) { - let json_encoded: String; match json::encode(&data) { Ok(d) => json_encoded = d, @@ -357,7 +355,6 @@ pub struct AuthCacheEntry { } impl AuthCache { - pub fn new() -> AuthCache { AuthCache { version: 1, @@ -429,7 +426,6 @@ impl CoreResourceManager { consumer: LoadConsumer, id_sender: Option>, resource_thread: CoreResourceThread) { - fn from_factory(factory: fn(LoadData, LoadConsumer, Arc, CancellationListener)) -> Box, cookie_jar: Arc>) -> WebSocketResult<(Headers, Sender, Receiver)> { - let host = Host { hostname: resource_url.host_str().unwrap().to_owned(), port: resource_url.port_or_known_default(), diff --git a/components/net_traits/image_cache_thread.rs b/components/net_traits/image_cache_thread.rs index ae0e6e7738d..3c4543574b1 100644 --- a/components/net_traits/image_cache_thread.rs +++ b/components/net_traits/image_cache_thread.rs @@ -116,7 +116,6 @@ pub struct ImageCacheThread { /// The public API for the image cache thread. impl ImageCacheThread { - /// Construct a new image cache pub fn new(chan: IpcSender) -> ImageCacheThread { ImageCacheThread { diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs index 1c1796df52a..d107e219988 100644 --- a/components/net_traits/response.rs +++ b/components/net_traits/response.rs @@ -163,7 +163,6 @@ impl Response { /// Convert to a filtered response, of type `filter_type`. /// Do not use with type Error or Default pub fn to_filtered(self, filter_type: ResponseType) -> Response { - assert!(filter_type != ResponseType::Error); assert!(filter_type != ResponseType::Default); @@ -179,7 +178,6 @@ impl Response { response.response_type = filter_type; match filter_type { - ResponseType::Default | ResponseType::Error => unreachable!(), ResponseType::Basic => { @@ -193,7 +191,6 @@ impl Response { }, ResponseType::CORS => { - let access = old_headers.get::(); let allowed_headers = access.as_ref().map(|v| &v[..]).unwrap_or(&[]); diff --git a/components/profile/mem.rs b/components/profile/mem.rs index 75cb8cf0f38..297584891c2 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -138,9 +138,7 @@ impl Profiler { let (chan, port) = ipc::channel().unwrap(); reporter.collect_reports(ReportsChan(chan)); if let Ok(mut reports) = port.recv() { - for report in &mut reports { - // Add "explicit" to the start of the path, when appropriate. match report.kind { ReportKind::ExplicitJemallocHeapSize | diff --git a/components/profile/time.rs b/components/profile/time.rs index 6498f85b30b..f45e7df8c71 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -182,7 +182,7 @@ impl Profiler { }); // decide if we need to spawn the timer thread match option { - &OutputOptions::FileName(_) => {/* no timer thread needed */}, + &OutputOptions::FileName(_) => { /* no timer thread needed */ }, &OutputOptions::Stdout(period) => { // Spawn a timer thread let chan = chan.clone(); @@ -389,7 +389,7 @@ impl Profiler { } writeln!(&mut lock, "").unwrap(); }, - None => {/* Do nothing if not output option has been set */}, + None => { /* Do nothing if not output option has been set */ }, }; } } diff --git a/components/script/cors.rs b/components/script/cors.rs index 7635f2b5738..f9d0bbbd264 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -122,11 +122,9 @@ impl CORSRequest { // framework right now. It would be worth redesigning http_fetch to do this properly. impl AsyncResponseListener for CORSContext { fn headers_available(&mut self, _metadata: Result) { - } fn data_available(&mut self, _payload: Vec) { - } fn response_complete(&mut self, _status: Result<(), NetworkError>) { diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 47d758d3028..19fe0f4fdc2 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -94,7 +94,6 @@ pub struct Blob { } impl Blob { - pub fn new(global: GlobalRef, slice: DataSlice, typeString: &str) -> Root { let boxed_blob = box Blob::new_inherited(slice, typeString); reflect_dom_object(boxed_blob, global, BlobBinding::Wrap) @@ -114,7 +113,6 @@ impl Blob { blobParts: Option>, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible> { - // TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView let bytes: Vec = match blobParts { None => Vec::new(), @@ -160,7 +158,6 @@ impl BlobMethods for Blob { end: Option, contentType: Option) -> Root { - let relativeContentType = match contentType { None => DOMString::new(), Some(mut str) => { diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 3afc31d71a7..9617dad4485 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -128,7 +128,6 @@ fn convert_request_device_options(options: &RequestDeviceOptions, } impl BluetoothMethods for Bluetooth { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice fn RequestDevice(&self, option: &RequestDeviceOptions) -> Fallible> { let (sender, receiver) = ipc::channel().unwrap(); diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index ad575b47e18..d82901b03de 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -49,7 +49,6 @@ impl BluetoothDevice { } impl BluetoothDeviceMethods for BluetoothDevice { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-id fn Id(&self) -> DOMString { self.id.clone() diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 5ad8d89c25b..cb1585b559f 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -75,7 +75,6 @@ impl BluetoothRemoteGATTCharacteristic { } impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties fn Properties(&self) -> Root { self.properties.get() diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index f7ed72ee0a8..03de0a52dd6 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -68,7 +68,6 @@ impl BluetoothRemoteGATTDescriptor { } impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic fn Characteristic(&self) -> Root { self.characteristic.get() diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 6935f0207eb..4813aa77183 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -49,7 +49,6 @@ impl BluetoothRemoteGATTServer { } impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device fn Device(&self) -> Root { self.device.get() diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs index ab51d37c6e7..dafda71a12b 100644 --- a/components/script/dom/bluetoothuuid.rs +++ b/components/script/dom/bluetoothuuid.rs @@ -270,7 +270,6 @@ const DESCRIPTOR_PREFIX: &'static str = "org.bluetooth.descriptor"; const VALID_UUID_REGEX: &'static str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; impl BluetoothUUID { - // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid pub fn CanonicalUUID(_: GlobalRef, alias: u32) -> UUID { DOMString::from(format!("{:08x}", &alias) + BASE_UUID) diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 88d11c78205..6507d013010 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -1040,7 +1040,6 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { sw: Finite, sh: Finite) -> Fallible> { - if !self.origin_is_clean() { return Err(Error::Security) } diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index dac16d72bcf..4da0b1a019c 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -182,7 +182,6 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { if shorthand.longhands().iter() .map(|&longhand| self.GetPropertyPriority(DOMString::from(longhand))) .all(|priority| priority == "important") { - return DOMString::from("important"); } // Step 3 diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index d02c57845ea..295b0029cb3 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -167,7 +167,6 @@ impl DedicatedWorkerGlobalScope { timer_event_chan: IpcSender, timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>) -> DedicatedWorkerGlobalScope { - DedicatedWorkerGlobalScope { workerglobalscope: WorkerGlobalScope::new_inherited(init, worker_url, diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 00dec5d995f..cda64a2070d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -600,7 +600,6 @@ impl Document { /// Reassign the focus context to the element that last requested focus during this /// transaction, or none if no elements requested it. pub fn commit_focus_transaction(&self, focus_type: FocusType) { - if let Some(ref elem) = self.focused.get() { let node = elem.upcast::(); elem.set_focus_state(false); @@ -755,7 +754,6 @@ impl Document { client_point: Point2D, pressure: f32, phase_now: TouchpadPressurePhase) { - let phase_before = self.touchpad_pressure_phase.get(); self.touchpad_pressure_phase.set(phase_now); diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index a53464739dc..a9af14d3d69 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -28,7 +28,6 @@ impl DOMQuad { p3: &DOMPoint, p4: &DOMPoint) -> DOMQuad { - DOMQuad { reflector_: Reflector::new(), p1: JS::from_ref(p1), diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index cf40c038c81..2d92c5995e3 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -758,7 +758,6 @@ impl Element { pub fn update_inline_style(&self, declarations: Vec, style_priority: StylePriority) { - fn update(element: &Element, mut declarations: Vec, style_priority: StylePriority) { let mut inline_declarations = element.style_attribute().borrow_mut(); if let &mut Some(ref mut existing_declarations) = &mut *inline_declarations { @@ -1285,7 +1284,6 @@ impl Element { // https://drafts.csswg.org/cssom-view/#dom-element-scroll pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) { - // Step 1.2 or 2.3 let x = if x_.is_finite() { x_ } else { 0.0f64 }; let y = if y_.is_finite() { y_ } else { 0.0f64 }; @@ -1476,7 +1474,6 @@ impl ElementMethods for Element { }); if let Some(position) = position { - let old_attr = Root::from_ref(&*self.attrs.borrow()[position]); // Step 3. diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index f566b4426b4..e8cdf89de54 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -80,7 +80,6 @@ impl File { } impl FileMethods for File { - // https://w3c.github.io/FileAPI/#dfn-name fn Name(&self) -> DOMString { self.name.clone() diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 175e771ffa7..58aa1dc1ba3 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -79,7 +79,7 @@ pub struct FileReader { impl FileReader { pub fn new_inherited() -> FileReader { FileReader { - eventtarget: EventTarget::new_inherited(),//? + eventtarget: EventTarget::new_inherited(), ready_state: Cell::new(FileReaderReadyState::Empty), error: MutNullableHeap::new(None), result: DOMRefCell::new(None), @@ -201,7 +201,6 @@ impl FileReader { // https://w3c.github.io/FileAPI/#dfn-readAsText fn perform_readastext(data: ReadMetaData, blob_bytes: &[u8]) -> DOMString { - let blob_label = &data.label; let blob_type = &data.blobtype; @@ -319,7 +318,6 @@ impl FileReaderMethods for FileReader { impl FileReader { fn dispatch_progress_event(&self, type_: Atom, loaded: u64, total: Option) { - let global = self.global(); let progressevent = ProgressEvent::new(global.r(), type_, EventBubbles::DoesNotBubble, EventCancelable::NotCancelable, diff --git a/components/script/dom/forcetouchevent.rs b/components/script/dom/forcetouchevent.rs index 1bc8a966cc5..e982cfdf86e 100644 --- a/components/script/dom/forcetouchevent.rs +++ b/components/script/dom/forcetouchevent.rs @@ -39,7 +39,6 @@ impl ForceTouchEvent { } impl<'a> ForceTouchEventMethods for &'a ForceTouchEvent { - fn ServoForce(&self) -> Finite { Finite::wrap(self.force) } diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 7807ad67870..37daa0ef6e0 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -516,7 +516,6 @@ impl Activatable for HTMLAnchorElement { let mut ismap_suffix = None; if let Some(element) = target.downcast::() { if target.is::() && element.has_attribute(&atom!("ismap")) { - let target_node = element.upcast::(); let rect = window_from_node(target_node).content_box_query( target_node.to_trusted_node_address()); diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index cf36ee9673b..5bd8f77e630 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -254,7 +254,6 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement { _context: *mut JSContext, _mime_type: Option, _arguments: Vec) -> Fallible { - // Step 1. if let Some(CanvasContext::Context2d(ref context)) = *self.context.borrow() { if !context.origin_is_clean() { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 8977d45048e..c9efb81ea7e 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -270,7 +270,6 @@ impl LayoutHTMLInputElementHelpers for LayoutJS { } impl HTMLInputElementMethods for HTMLInputElement { - // https://html.spec.whatwg.org/multipage/#dom-input-accept make_getter!(Accept, "accept"); @@ -786,7 +785,6 @@ impl VirtualMethods for HTMLInputElement { let new_value_mode = self.value_mode(); match (&old_value_mode, old_idl_value.is_empty(), new_value_mode) { - // Step 1 (&ValueMode::Value, false, ValueMode::Default) | (&ValueMode::Value, false, ValueMode::DefaultOn) => { diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 711e0ba740c..71dccf4be27 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1638,7 +1638,6 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-clone pub fn clone(node: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag) -> Root { - // Step 1. let document = match maybe_doc { Some(doc) => Root::from_ref(doc), @@ -1994,7 +1993,6 @@ impl NodeMethods for Node { // https://dom.spec.whatwg.org/#concept-node-replace fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible> { - // Step 1. match self.type_id() { NodeTypeId::Document(_) | diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 2753465d49e..14b8f240fbb 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -166,7 +166,6 @@ impl NodeIteratorMethods for NodeIterator { // Step 3-1. for preceding_node in node.preceding_nodes(&self.root_node) { - // Step 3-2. let result = try!(self.accept_node(preceding_node.r())); diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index 02da92f3b89..9fe012fbc1c 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -37,7 +37,6 @@ impl PerformanceTiming { navigation_start: u64, navigation_start_precise: f64) -> Root { - let timing = PerformanceTiming::new_inherited(navigation_start, navigation_start_precise, window.Document().r()); diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs index 5cbf589b7e7..aabba4928a4 100644 --- a/components/script/dom/pluginarray.rs +++ b/components/script/dom/pluginarray.rs @@ -32,7 +32,6 @@ impl PluginArray { impl PluginArrayMethods for PluginArray { // https://html.spec.whatwg.org/multipage/#dom-pluginarray-refresh fn Refresh(&self, _reload: bool) { - } // https://html.spec.whatwg.org/multipage/#dom-pluginarray-length diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index bd2cbb21aa7..7595566f275 100644 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -53,7 +53,6 @@ impl ValidityState { } impl ValidityStateMethods for ValidityState { - // https://html.spec.whatwg.org/multipage/#dom-validitystate-valuemissing fn ValueMissing(&self) -> bool { false diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 8735394a7a9..c947a587687 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -382,7 +382,6 @@ impl WebSocketMethods for WebSocket { // https://html.spec.whatwg.org/multipage/#dom-websocket-send fn Send(&self, data: USVString) -> ErrorResult { - let data_byte_len = data.0.as_bytes().len() as u64; let send_data = try!(self.send_impl(data_byte_len)); @@ -397,7 +396,6 @@ impl WebSocketMethods for WebSocket { // https://html.spec.whatwg.org/multipage/#dom-websocket-send fn Send_(&self, blob: &Blob) -> ErrorResult { - /* As per https://html.spec.whatwg.org/multipage/#websocket the buffered amount needs to be clamped to u32, even though Blob.Size() is u64 If the buffer limit is reached in the first place, there are likely other major problems diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 2cd6c4daf9e..d77645d49e9 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1197,7 +1197,6 @@ impl Window { // https://drafts.csswg.org/cssom-view/#dom-element-scroll pub fn scroll_node(&self, node: TrustedNodeAddress, x_: f64, y_: f64, behavior: ScrollBehavior) { - self.reflow(ReflowGoal::ForScriptQuery, ReflowQueryType::NodeLayerIdQuery(node), ReflowReason::Query); diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 5d70af5b059..19cc5f861c2 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -835,7 +835,6 @@ impl ScriptThread { fn profile_event(&self, category: ScriptThreadEventCategory, f: F) -> R where F: FnOnce() -> R { - if opts::get().profile_script_events { let profiler_cat = match category { ScriptThreadEventCategory::AttachLayout => ProfilerCategory::ScriptAttachLayout, @@ -1693,7 +1692,6 @@ impl ScriptThread { /// /// TODO: Actually perform DOM event dispatch. fn handle_event(&self, pipeline_id: PipelineId, event: CompositorEvent) { - // DOM events can only be handled if there's a root browsing context. if !self.root_browsing_context_exists() { return; diff --git a/components/script/timers.rs b/components/script/timers.rs index 18058b7f9f7..53113e06682 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -264,7 +264,6 @@ impl OneshotTimers { is_interval: IsInterval, source: TimerSource) -> i32 { - self.js_timers.set_timeout_or_interval(global, callback, arguments, @@ -478,7 +477,6 @@ impl JsTimerTask { // reschedule repeating timers when they were not canceled as part of step 4.2. if self.is_interval == IsInterval::Interval && timers.active_timers.borrow().contains_key(&self.handle) { - timers.initialize_and_schedule(this.global().r(), self); } } diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 017a7443624..c479c5ef5d5 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -268,7 +268,6 @@ impl Stylist { -> Option> { debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_precomputed()); if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) { - let (computed, _) = properties::cascade(self.device.au_viewport_size(), &declarations, false, diff --git a/components/style/values.rs b/components/style/values.rs index 9492a028cfc..8ec5ca5f2ca 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -807,7 +807,6 @@ pub mod specified { impl ToCss for CalcLengthOrPercentage { #[allow(unused_assignments)] fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - macro_rules! count { ( $( $val:ident ),* ) => { { @@ -1139,7 +1138,6 @@ pub mod specified { } impl PositionComponent { pub fn parse(input: &mut Parser) -> Result { - input.try(LengthOrPercentage::parse) .map(PositionComponent::LengthOrPercentage) .or_else(|()| { diff --git a/components/util/opts.rs b/components/util/opts.rs index 50541140b70..33d5ee5c1ac 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -471,7 +471,6 @@ const DEFAULT_USER_AGENT: UserAgent = UserAgent::Gonk; const DEFAULT_USER_AGENT: UserAgent = UserAgent::Desktop; pub fn default_opts() -> Opts { - Opts { is_running_problem_test: false, url: Some(Url::parse("about:blank").unwrap()), diff --git a/components/util/panicking.rs b/components/util/panicking.rs index 9e53ba83eed..20b3d002443 100644 --- a/components/util/panicking.rs +++ b/components/util/panicking.rs @@ -28,7 +28,6 @@ pub fn set_thread_local_hook(local: Box) { /// Initiates the custom panic hook /// Should be called in main() after arguments have been parsed pub fn initiate_panic_hook() { - // Set the panic handler only once. It is global. HOOK_SET.call_once(|| { // The original backtrace-printing hook. We still want to call this diff --git a/components/util/time.rs b/components/util/time.rs index 8186fc2ebed..4a751c95ee1 100644 --- a/components/util/time.rs +++ b/components/util/time.rs @@ -8,7 +8,6 @@ use std::{u32, u64}; pub const NANOS_PER_SEC: u32 = 1_000_000_000; pub fn duration_from_seconds(secs: f64) -> Duration { - // Get number of seconds and check that it fits in a u64. let whole_secs = secs.trunc(); assert!(whole_secs >= 0.0 && whole_secs <= u64::MAX as f64); diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs index dbb66a20aa1..5aef7da27d0 100644 --- a/components/util/workqueue.rs +++ b/components/util/workqueue.rs @@ -275,7 +275,6 @@ impl WorkQueue { // Spawn threads. for (i, thread) in threads.into_iter().enumerate() { - spawn_named( format!("{} worker {}/{}", thread_name, i + 1, thread_count), move || { diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 0b5865cdb61..6f7abee4c63 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -778,7 +778,6 @@ impl WebDriverHandler for Handler { fn handle_command(&mut self, _session: &Option, msg: &WebDriverMessage) -> WebDriverResult { - // Unless we are trying to create a new session, we need to ensure that a // session has previously been created match msg.command { diff --git a/ports/geckolib/data.rs b/ports/geckolib/data.rs index 34d184239c1..dd0fa4dc18d 100644 --- a/ports/geckolib/data.rs +++ b/ports/geckolib/data.rs @@ -20,7 +20,6 @@ use util::thread_state; use util::workqueue::WorkQueue; pub struct PerDocumentStyleData { - /// Rule processor. pub stylist: Arc, diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 0c4a7070823..38f4827bea0 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -140,7 +140,6 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, referrer: *mut ThreadSafeURIHolder, principal: *mut ThreadSafePrincipalHolder) -> *mut RawServoStyleSheet { - let input = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) }; let origin = match mode { diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 4d3da2ef176..5677d741f5b 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -785,7 +785,6 @@ impl WindowMethods for Window { /// Helper function to handle keyboard events. fn handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) { - match (mods, key) { (_, Key::Equal) => { if mods & !SHIFT == CMD_OR_CONTROL { diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index 20394979965..676e07d696c 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -796,11 +796,9 @@ impl WindowMethods for Window { } fn set_inner_size(&self, _: Size2D) { - } fn set_position(&self, _: Point2D) { - } /// Presents the window to the screen (perhaps by page flipping). diff --git a/tests/compiletest/helper/lib.rs b/tests/compiletest/helper/lib.rs index 2ec43d3f522..7c7b076c1bc 100644 --- a/tests/compiletest/helper/lib.rs +++ b/tests/compiletest/helper/lib.rs @@ -8,7 +8,6 @@ use std::env; use std::path::PathBuf; pub fn run_mode(mode: &'static str) { - let mut config = compiletest::default_config(); let cfg_mode = mode.parse().ok().expect("Invalid mode"); diff --git a/tests/unit/net/fetch.rs b/tests/unit/net/fetch.rs index a53807bff38..4803eee5178 100644 --- a/tests/unit/net/fetch.rs +++ b/tests/unit/net/fetch.rs @@ -42,7 +42,6 @@ impl AsyncFetchListener for FetchResponseCollector { } fn make_server(handler: H) -> (Listening, Url) { - // this is a Listening server because of handle_threads() let server = Server::http("0.0.0.0:0").unwrap().handle_threads(handler, 1).unwrap(); let port = server.socket.port().to_string(); @@ -54,7 +53,6 @@ fn make_server(handler: H) -> (Listening, Url) { #[test] fn test_fetch_response_is_not_network_error() { - static MESSAGE: &'static [u8] = b""; let handler = move |_: HyperRequest, response: HyperResponse| { response.send(MESSAGE).unwrap(); @@ -76,7 +74,6 @@ fn test_fetch_response_is_not_network_error() { #[test] fn test_fetch_response_body_matches_const_message() { - static MESSAGE: &'static [u8] = b"Hello World!"; let handler = move |_: HyperRequest, response: HyperResponse| { response.send(MESSAGE).unwrap(); @@ -104,7 +101,6 @@ fn test_fetch_response_body_matches_const_message() { #[test] fn test_fetch_aboutblank() { - let url = Url::parse("about:blank").unwrap(); let origin = Origin::Origin(url.origin()); let mut request = Request::new(url, Some(origin), false); @@ -118,7 +114,6 @@ fn test_fetch_aboutblank() { #[test] fn test_fetch_data() { - let url = Url::parse("data:text/html,

Servo

").unwrap(); let origin = Origin::Origin(url.origin()); let request = Request::new(url, Some(origin), false); @@ -145,7 +140,6 @@ fn test_fetch_data() { #[test] fn test_fetch_file() { - let mut path = resources_dir_path(); path.push("servo.css"); @@ -295,10 +289,8 @@ fn test_cors_preflight_fetch_network_error() { #[test] fn test_fetch_response_is_basic_filtered() { - static MESSAGE: &'static [u8] = b""; let handler = move |_: HyperRequest, mut response: HyperResponse| { - response.headers_mut().set(SetCookie(vec![])); // this header is obsoleted, so hyper doesn't implement it, but it's still covered by the spec response.headers_mut().set_raw("Set-Cookie2", vec![]); @@ -325,10 +317,8 @@ fn test_fetch_response_is_basic_filtered() { #[test] fn test_fetch_response_is_cors_filtered() { - static MESSAGE: &'static [u8] = b""; let handler = move |_: HyperRequest, mut response: HyperResponse| { - // this is mandatory for the Cors Check to pass // TODO test using different url encodings with this value ie. punycode response.headers_mut().set(AccessControlAllowOrigin::Any); @@ -383,7 +373,6 @@ fn test_fetch_response_is_cors_filtered() { #[test] fn test_fetch_response_is_opaque_filtered() { - static MESSAGE: &'static [u8] = b""; let handler = move |_: HyperRequest, response: HyperResponse| { response.send(MESSAGE).unwrap(); @@ -419,10 +408,8 @@ fn test_fetch_response_is_opaque_filtered() { #[test] fn test_fetch_response_is_opaque_redirect_filtered() { - static MESSAGE: &'static [u8] = b""; let handler = move |request: HyperRequest, mut response: HyperResponse| { - let redirects = match request.uri { RequestUri::AbsolutePath(url) => url.split("/").collect::().parse::().unwrap_or(0), @@ -500,9 +487,7 @@ fn test_fetch_with_local_urls_only() { } fn setup_server_and_fetch(message: &'static [u8], redirect_cap: u32) -> Response { - let handler = move |request: HyperRequest, mut response: HyperResponse| { - let redirects = match request.uri { RequestUri::AbsolutePath(url) => url.split("/").collect::().parse::().unwrap_or(0), @@ -534,7 +519,6 @@ fn setup_server_and_fetch(message: &'static [u8], redirect_cap: u32) -> Response #[test] fn test_fetch_redirect_count_ceiling() { - static MESSAGE: &'static [u8] = b"no more redirects"; // how many redirects to cause let redirect_cap = 20; @@ -554,7 +538,6 @@ fn test_fetch_redirect_count_ceiling() { #[test] fn test_fetch_redirect_count_failure() { - static MESSAGE: &'static [u8] = b"this message shouldn't be reachable"; // how many redirects to cause let redirect_cap = 21; @@ -570,12 +553,10 @@ fn test_fetch_redirect_count_failure() { } fn test_fetch_redirect_updates_method_runner(tx: Sender, status_code: StatusCode, method: Method) { - let handler_method = method.clone(); let handler_tx = Arc::new(Mutex::new(tx)); let handler = move |request: HyperRequest, mut response: HyperResponse| { - let redirects = match request.uri { RequestUri::AbsolutePath(url) => url.split("/").collect::().parse::().unwrap_or(0), @@ -587,12 +568,10 @@ fn test_fetch_redirect_updates_method_runner(tx: Sender, status_code: Stat let mut test_pass = true; if redirects == 0 { - *response.status_mut() = StatusCode::TemporaryRedirect; response.headers_mut().set(Location("1".to_owned())); } else if redirects == 1 { - // this makes sure that the request method does't change from the wrong status code if handler_method != Method::Get && request.method == Method::Get { test_pass = false; @@ -625,7 +604,6 @@ fn test_fetch_redirect_updates_method_runner(tx: Sender, status_code: Stat #[test] fn test_fetch_redirect_updates_method() { - let (tx, rx) = channel(); test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::MovedPermanently, Method::Post); @@ -665,7 +643,6 @@ fn test_fetch_redirect_updates_method() { } fn response_is_done(response: &Response) -> bool { - let response_complete = match response.response_type { ResponseType::Default | ResponseType::Basic | ResponseType::CORS => { (*response.body.lock().unwrap()).is_done() @@ -685,7 +662,6 @@ fn response_is_done(response: &Response) -> bool { #[test] fn test_fetch_async_returns_complete_response() { - static MESSAGE: &'static [u8] = b"this message should be retrieved in full"; let handler = move |_: HyperRequest, response: HyperResponse| { response.send(MESSAGE).unwrap(); @@ -710,7 +686,6 @@ fn test_fetch_async_returns_complete_response() { #[test] fn test_opaque_filtered_fetch_async_returns_complete_response() { - static MESSAGE: &'static [u8] = b""; let handler = move |_: HyperRequest, response: HyperResponse| { response.send(MESSAGE).unwrap(); @@ -737,10 +712,8 @@ fn test_opaque_filtered_fetch_async_returns_complete_response() { #[test] fn test_opaque_redirect_filtered_fetch_async_returns_complete_response() { - static MESSAGE: &'static [u8] = b""; let handler = move |request: HyperRequest, mut response: HyperResponse| { - let redirects = match request.uri { RequestUri::AbsolutePath(url) => url.split("/").collect::().parse::().unwrap_or(0), diff --git a/tests/unit/net/http_loader.rs b/tests/unit/net/http_loader.rs index a9aec911d7a..68f677b46af 100644 --- a/tests/unit/net/http_loader.rs +++ b/tests/unit/net/http_loader.rs @@ -976,7 +976,6 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() { #[test] fn test_when_cookie_set_marked_httpsonly_secure_isnt_sent_on_http_request() { - let sec_url = Url::parse("https://mozilla.com").unwrap(); let url = Url::parse("http://mozilla.com").unwrap(); @@ -1609,7 +1608,6 @@ fn test_referer_set_to_origin_with_originonly_policy() { #[test] fn test_referer_set_to_stripped_url_with_unsafeurl_policy() { - let request_url = "http://mozilla.com"; let referrer_url = "http://username:password@someurl.com/some/path#fragment"; let referrer_policy = Some(ReferrerPolicy::UnsafeUrl); @@ -1787,7 +1785,6 @@ fn test_no_referrer_policy_follows_noreferrerwhendowngrade_http_to_http() { #[test] fn test_no_referer_set_with_noreferrer_policy() { - let request_url = "http://mozilla.com"; let referrer_url = "http://someurl.com"; let referrer_policy = Some(ReferrerPolicy::NoReferrer); diff --git a/tests/unit/util/prefs.rs b/tests/unit/util/prefs.rs index 20ad1cdbca1..7deefd398be 100644 --- a/tests/unit/util/prefs.rs +++ b/tests/unit/util/prefs.rs @@ -48,7 +48,6 @@ fn test_get_set_reset_extend() { #[test] fn test_default_config_dir_create_read_write() { - let json_str = "{\ \"layout.writing-mode.enabled\": true,\ \"extra.stuff\": false,\