Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 2018-edition idioms in crates that use that edition #22133

Merged
merged 3 commits into from Nov 8, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Remove useless `use crate_name;` imports.

A `crate_name::foo` path always works in 2018
  • Loading branch information
SimonSapin committed Nov 8, 2018
commit 9f977c52878e3638f475ca9a78e9f57d0d22893d
@@ -6,7 +6,6 @@ use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use string_cache_codegen;

fn main() {
let static_atoms =
@@ -15,11 +15,9 @@ use cssparser::RGBA;
use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use ipc_channel::ipc::IpcSender;
use num_traits::ToPrimitive;
use pixels;
use serde_bytes::ByteBuf;
use std::mem;
use std::sync::Arc;
use webrender_api;

pub struct CanvasData<'a> {
drawtarget: DrawTarget,
@@ -10,7 +10,6 @@ use ipc_channel::ipc::{self, IpcSender};
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::thread;
use webrender_api;

pub struct CanvasPaintThread<'a> {
canvases: HashMap<CanvasId, CanvasData<'a>>,
@@ -13,8 +13,6 @@ use fnv::FnvHashMap;
use gleam::gl;
use servo_config::prefs::PREFS;
use std::rc::Rc;
use webrender;
use webrender_api;

/// WebGL Threading API entry point that lives in the constellation.
pub struct WebGLThreads(WebGLSender<WebGLMsg>);
@@ -8,10 +8,7 @@ use euclid::Size2D;
use fnv::FnvHashMap;
use gleam::gl;
use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods};
use pixels;
use std::thread;
use webrender;
use webrender_api;

/// WebGL Threading API entry point that lives in the constellation.
/// It allows to get a WebGLThread handle for each script pipeline.
@@ -8,7 +8,6 @@ use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender};
use serde_bytes::ByteBuf;
use std::default::Default;
use std::str::FromStr;
use webrender_api;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FillRule {
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use ipc_channel;
use serde::{Deserialize, Serialize};
use std::io;

@@ -8,7 +8,6 @@ pub mod base_channel {
// Needed to re-export the select macro.
pub use crossbeam_channel::*;

use crossbeam_channel;
use ipc_channel::ipc::IpcReceiver;
use ipc_channel::router::ROUTER;
use serde::{Deserialize, Serialize};
@@ -6,7 +6,6 @@ use std::env;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
use toml;

fn main() {
let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap())
@@ -40,7 +40,6 @@ use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use time::{now, precise_time_ns, precise_time_s};
use webrender;
use webrender_api::{self, DeviceIntPoint, DevicePoint, HitTestFlags, HitTestResult};
use webrender_api::{LayoutVector2D, ScrollLocation};

@@ -17,7 +17,6 @@ use script_traits::{AnimationState, ConstellationMsg, EventResult};
use servo_channel::{Receiver, Sender};
use std::fmt::{Debug, Error, Formatter};
use style_traits::viewport::ViewportConstraints;
use webrender;
use webrender_api::{self, DeviceIntPoint, DeviceUintSize};

/// Sends messages to the compositor.
@@ -8,7 +8,6 @@
use crate::prefs::{self, PrefValue, PREFS};
use euclid::TypedSize2D;
use getopts::Options;
use num_cpus;
use servo_geometry::DeviceIndependentPixel;
use servo_url::ServoUrl;
use std::borrow::Cow;
@@ -5,7 +5,6 @@
use crate::basedir::default_config_dir;
use crate::opts;
use embedder_traits::resources::{self, Resource};
use num_cpus;
use serde_json::{self, Value};
use std::borrow::ToOwned;
use std::cmp::max;
@@ -110,7 +110,6 @@ use crate::session_history::{
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
};
use crate::timer_scheduler::TimerScheduler;
use debugger;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use euclid::{Size2D, TypedScale, TypedSize2D};
@@ -164,7 +163,6 @@ use std::thread;
use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use style_traits::CSSPixel;
use webrender_api;
use webvr_traits::{WebVREvent, WebVRMsg};

/// Servo supports tabs (referred to as browsers), so `Constellation` needs to
@@ -41,7 +41,6 @@ use std::rc::Rc;
use std::sync::Arc;
use style_traits::CSSPixel;
use style_traits::DevicePixel;
use webrender_api;
use webvr_traits::WebVRMsg;

/// A `Pipeline` is the constellation's view of a `Document`. Each pipeline has an
@@ -5,7 +5,6 @@
#[macro_use]
extern crate log;

use servo_channel;
use std::thread;
use ws::{self, Builder, CloseCode, Handler, Handshake};

@@ -5,7 +5,6 @@
extern crate proc_macro;

use std::str::FromStr;
use syn;
use synstructure::{self, decl_derive};

decl_derive!([DenyPublicFields] => deny_public_fields_derive);
@@ -16,7 +16,6 @@ use http::{header, HeaderMap};
use hyper::{Method, StatusCode};
use serde_json::{Map, Value};
use std::net::TcpStream;
use time;
use time::Tm;

struct HttpRequest {
@@ -27,9 +27,7 @@ use std::sync::Arc;
use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight};
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::SingleFontFamily;
use time;
use unicode_script::Script;
use webrender_api;

macro_rules! ot_tag {
($t1:expr, $t2:expr, $t3:expr, $t4:expr) => {
@@ -12,7 +12,6 @@ use crate::platform::font_list::for_each_variation;
use crate::platform::font_list::system_default_family;
use crate::platform::font_list::SANS_SERIF_FONT_FAMILY;
use crate::platform::font_template::FontTemplateData;
use fontsan;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use net_traits::request::{Destination, RequestInit};
use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
@@ -25,7 +24,6 @@ use std::sync::{Arc, Mutex};
use std::{f32, fmt, mem, thread};
use style::font_face::{EffectiveSources, Source};
use style::values::computed::font::FamilyName;
use webrender_api;

/// A list of font templates that make up a given font family.
pub struct FontTemplates {
@@ -21,7 +21,6 @@ use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use style::computed_values::font_variant_caps::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct;
use webrender_api;

static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h)

@@ -12,7 +12,6 @@ use fontconfig::fontconfig::{
FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString,
};
use fontconfig::fontconfig::{FcObjectSetAdd, FcPatternGetInteger};
use libc;
use libc::{c_char, c_int};
use std::ffi::CString;
use std::ptr;
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use core_text;
use crate::text::util::unicode_plane;
use ucd::{Codepoint, UnicodeBlock};

@@ -5,7 +5,6 @@
use app_units::Au;
use core_graphics::data_provider::CGDataProvider;
use core_graphics::font::CGFont;
use core_text;
use core_text::font::CTFont;
use serde::de::{Error, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
@@ -13,7 +13,6 @@ use crate::platform::font_template::FontTemplateData;
use crate::platform::windows::font_context::FontContextHandle;
use crate::platform::windows::font_list::font_from_atom;
use crate::text::glyph::GlyphId;
use dwrote;
use dwrote::{Font, FontFace, FontFile};
use dwrote::{FontStretch, FontStyle};
use servo_atoms::Atom;
@@ -26,7 +25,6 @@ use style::values::computed::font::FontStyle as StyleFontStyle;
use style::values::generics::font::FontStyle as GenericFontStyle;
use style::values::generics::NonNegative;
use style::values::specified::font::FontStretchKeyword;
use truetype;

// 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch
fn pt_to_px(pt: f64) -> f64 {
@@ -24,7 +24,6 @@ use style::values::computed::font::{
};
use style::values::computed::font::{FontStretch, FontWeight, SingleFontFamily};
use style::values::generics::font::FontStyle;
use webrender_api;

struct TestFontSource {
handle: FontContextHandle,
@@ -14,7 +14,6 @@ use std::slice::Iter;
use std::sync::Arc;
use style::str::char_is_whitespace;
use unicode_bidi as bidi;
use webrender_api;
use xi_unicode::LineBreakLeafIter;

thread_local! {
@@ -7,8 +7,6 @@ extern crate syn;
#[macro_use]
extern crate synstructure;

use quote;

decl_derive!([JSTraceable] => js_traceable_derive);

fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens {
@@ -23,7 +23,6 @@ use crate::text::TextRunScanner;
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::ServoArc;
use euclid::{Point2D, Rect, Size2D, Vector2D};
use gfx;
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
use gfx_traits::StackingContextId;
@@ -15,7 +15,6 @@ use crate::flow_ref::FlowRef;
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes};
use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal};
use profile_traits::time::{self, profile, TimerMetadata};
use rayon;
use servo_config::opts;
use smallvec::SmallVec;
use std::mem;
@@ -21,7 +21,6 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg};
use servo_channel::{Receiver, Sender};
use servo_url::ServoUrl;
use std::sync::Arc;
use webrender_api;

// A static method creating a layout thread
// Here to remove the compositor -> layout dependency
@@ -8,7 +8,6 @@
use std::cell::Cell;
use std::fmt;
use std::num::NonZeroU32;
use webrender_api;

#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum TraversalDirection {
@@ -5,7 +5,6 @@
//! Implementation of cookie creation and matching as specified by
//! http://tools.ietf.org/html/rfc6265

use cookie_rs;
use hyper_serde::{self, Serde};
use net_traits::pub_domains::is_pub_domain;
use net_traits::CookieSource;
@@ -5,7 +5,6 @@
//! Implementation of cookie storage as specified in
//! http://tools.ietf.org/html/rfc6265

use cookie_rs;
use crate::cookie::Cookie;
use net_traits::pub_domains::reg_suffix;
use net_traits::CookieSource;
@@ -5,11 +5,9 @@
use embedder_traits::resources::{self, Resource};
use net_traits::pub_domains::reg_suffix;
use net_traits::IncludeSubdomains;
use serde_json;
use servo_url::ServoUrl;
use std::collections::HashMap;
use std::net::{Ipv4Addr, Ipv6Addr};
use time;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HstsEntry {
@@ -29,7 +29,6 @@ use std::ops::Bound;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Mutex;
use std::time::SystemTime;
use time;
use time::{Duration, Timespec, Tm};

/// The key used to differentiate requests in the cache.
@@ -36,8 +36,6 @@ use http::uri::Authority;
use http::{HeaderMap, Request as HyperRequest};
use hyper::{Body, Client, Method, Response as HyperResponse, StatusCode};
use hyper_serde::Serde;
use log;
use mime;
use msg::constellation_msg::{HistoryStateId, PipelineId};
use net_traits::quality::{quality_to_value, Quality, QualityItem};
use net_traits::request::{CacheMode, CredentialsMode, Destination, Origin};
@@ -61,7 +59,6 @@ use std::time::{Duration, SystemTime};
use time::{self, Tm};
use tokio::prelude::{future, Future, Stream};
use tokio::runtime::Runtime;
use uuid;

lazy_static! {
pub static ref HANDLE: Mutex<Runtime> = { Mutex::new(Runtime::new().unwrap()) };
@@ -9,15 +9,13 @@ use net_traits::image_cache::{CanRequestImages, ImageCache, ImageResponder};
use net_traits::image_cache::{ImageOrMetadataAvailable, ImageResponse, ImageState};
use net_traits::image_cache::{PendingImageId, UsePlaceholder};
use net_traits::{FetchMetadata, FetchResponseMsg, NetworkError};
use pixels;
use servo_url::ServoUrl;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::HashMap;
use std::io;
use std::mem;
use std::sync::{Arc, Mutex};
use std::thread;
use webrender_api;

///
/// TODO(gw): Remaining work on image cache:
@@ -4,7 +4,6 @@

//! A thread that takes a URL and streams back the binary data.

use cookie_rs;
use crate::connector::{create_http_client, create_ssl_connector_builder};
use crate::cookie;
use crate::cookie_storage::CookieStorage;
@@ -33,8 +32,6 @@ use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::mem::{Report, ReportKind, ReportsChan};
use profile_traits::time::ProfilerChan;
use serde::{Deserialize, Serialize};
use serde_json;
use servo_allocator;
use servo_channel::Sender;
use servo_config::opts;
use servo_url::ServoUrl;
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cookie_rs;
use net::cookie::Cookie;
use net::cookie_storage::CookieStorage;
use net_traits::CookieSource;
@@ -5,7 +5,6 @@
use net::hsts::{HstsEntry, HstsList};
use net_traits::IncludeSubdomains;
use std::collections::HashMap;
use time;

#[test]
fn test_hsts_entry_is_not_expired_when_it_has_no_timestamp() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.